Data manufacturing frameworks for synthesizing synthetic training data to facilitate training a natural language to logical form model

ABSTRACT

Techniques are disclosed herein for synthesizing synthetic training data to facilitate training a natural language to logical form model. In one aspect, training data can be synthesized from original under a framework based on templates and a synchronous context-free grammar. In one aspect, training data can be synthesized under a framework based on a probabilistic context-free grammar and a translator. In one aspect, training data can be synthesized under a framework based on tree-to-string translation. In one aspect, the synthetic training data can be combined with original training data in order to train a machine learning model to translate an utterance to a logical form.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a non-provisional application of and claims benefit and priority under 35 U.S.C. 119(e) of U.S. Provisional Application No. 63/289,480, filed Dec. 14, 2021, the entire contents of which is incorporated herein by reference for all purposes.

FIELD

The present disclosure generally relates to transforming natural language to Structured Query Language, and more particularly, to data manufacturing frameworks for synthesizing synthetic training data to facilitate training a natural language to logical form model.

BACKGROUND

Structured Query Language (SQL) is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handling structured data (i.e., data incorporating relations among entities and variables). SQL includes sublanguages such as a data query language (DQL), a data definition language (DDL), a data control language (DCL), and a data manipulation language (DML). The scope of SQL includes data query, data manipulation (insert, update, and delete), data definition (schema creation and modification), and data access control. Although SQL is essentially a declarative language (4GL), it also includes procedural elements. In order to effectively leverage data, RDBMS and RDSMS users are required to not only have prior knowledge about the database schema (e.g., table and column names) but also a working understanding of the syntax and semantics of SQL. Nonetheless, despite its expressiveness, SQL can often hinder non-technical users from exploring and making use of their data.

Natural language is an alternative interface to data held or implemented in RDBMS and RDSMS because it allows non-technical users to formulate complex questions in a more concise manner than SQL. Using semantic parsing, natural language statements, requests, and questions can be transformed into logical forms or meaning representations that can be executed by an application (e.g., model, program, machine, etc.). For example, semantic parsing can transform natural language sentences directly into general purpose programming languages such as Python, Java, and SQL. Processes for transforming natural language sentences to SQL queries typically include rule-based, statistical-based, and deep learning-based systems. Rule-based systems typically use a series of fixed rules to translate the natural language sentences to SQL queries. Rule-based systems are generally domain-specific and, thus, are considered inelastic and do not generalize well to new use cases (e.g., across different domains). Statistical-based systems label tokens (i.e., words or phrases) in an input natural language sentence according to their semantic role in the sentence and use the labels to fill slots in the SQL query but have limitations on the types of sentences that can be parsed (e.g., a sentence must be able to be represented as a parse tree). Deep learning-based systems, such as sequence-to-sequence models, involve training deep learning models that directly translate the natural language sentences to SQL queries and have been shown to generalize well to new use cases.

BRIEF SUMMARY

Data manufacturing frameworks are disclosed herein for synthesizing synthetic training data to facilitate training a natural language to logical form model.

In some embodiments, a method includes accessing original training data, the original training including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; generating a plurality of templates, each template of the plurality of templates including a delexicalized version of an utterance in the plurality of utterances and a delexicalized version of a logical form corresponding to the utterance; learning a grammar from the plurality of logical forms, the grammar defining a plurality of production rules for lexicalizing the plurality of templates; generating synthetic training data by parsing each template of the plurality of templates, sampling a database to identify a plurality of sampling components, a lexicalizing each template of the plurality of templates with at least one sampling component of the plurality of sampling components; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.

In some embodiments, the plurality of templates is generated automatically from the plurality of utterances and the plurality of logical forms using a machine-learning model.

In some embodiments, the grammar is a synchronous context-free grammar.

In some embodiments, learning the grammar comprises setting one or more table names, column names, and values in database schema information included in the original training data as non-terminal symbols and generating the plurality of production rules by replacing one or more words, entities, or phrases in the plurality of utterances with the set non-terminal symbols.

In some embodiments, each template of the plurality of templates is parsed by applying a synchronous context-free grammar to the delexicalized version of the utterance and the delexicalized version of the logical form of respective template to generate an abstract syntax tree for the respective template.

In some embodiments, lexicalizing each template of the plurality of templates with at least one sampling component of the plurality of sampling components comprises analyzing each template of the plurality of templates to identify one or more constraints in the respective template and sampling components of a databased based on the identified one or more constraints in respective template.

In some embodiments, the method further includes accessing an utterance; inputting the utterance into the trained machine learning model; translating, using the trained machine learning model, the utterance into a logical form; executing the logical form as a query on a database to retrieve a result for the query; and outputting the result for the utterance.

In some embodiments, a method includes accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; obtaining a pre-trained model trained to translate utterances to logical forms; finetuning the pre-trained model to translate logical forms to utterances, wherein the finetuning is performed using the original training data and generates a finetuned model; generating a set of delexicalized logical forms, at least one delexicalized logical form of the set of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by the finetuned model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.

In some embodiments, finetuning the pre-trained model comprises adjusting weights and parameters of the pre-trained model based on the original training data and using one or more machine learning optimization techniques.

In some embodiments, at least one delexicalized logical form of the set of delexicalized forms in generated automatically using a machine-learning model.

In some embodiments, at least one delexicalized logical form of the set of delexicalized logical forms is generated using a probabilistic context-free grammar.

In some embodiments, generating the set of lexicalized logical forms comprises analyzing each delexicalized logical form of the set of delexicalized logical forms to identify one or more constraints in the respective delexicalized logical form and sampling components of a database based on the identified one or more constraints in respective delexicalized logical form.

In some embodiments, generating the synthetic training data comprises translating, by the finetuned model, each lexicalized logical form of the set of lexicalized logical forms into an utterance.

In some embodiments, the method further includes accessing a natural language utterance; inputting the natural language utterance into the trained machine learning model; translating, using the trained machine learning model, the natural language utterance into a logical form; executing the one or more logical forms as a query on a database to retrieve a result for the query; and outputting the result for the natural language utterance.

In some embodiments, a method includes accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; generating a set of abstract syntax trees for the plurality of logical forms; generating a set of delexicalized logical forms, each delexicalized logical form of the plurality of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by a tree-to-string model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.

In some embodiments, the set of abstract syntax trees are generated for the plurality of logical forms by parsing each logical form of the plurality of logical forms into an abstract syntax tree and normalizing the respective abstract syntax tree.

In some embodiments, at least one delexicalized logical form of the set of delexicalized forms in generated automatically using a machine-learning model.

In some embodiments, generating the set of lexicalized logical forms comprises analyzing each delexicalized logical form of the set of delexicalized logical forms to identify one or more constraints in the respective delexicalized logical form and sampling components of a database based on the identified one or more constraints in respective delexicalized logical form.

In some embodiments, the generating the synthetic training data comprises translating, by the tree-to-string model, each lexicalized logical form of the set of lexicalized logical forms into an utterance.

In some embodiments, the generating the synthetic training data comprises reordering each abstract syntax tree of the set of abstract syntax trees and decoding each of the reordered abstract syntax trees into an utterance.

In some embodiments, the method further includes accessing a natural language utterance; inputting the natural language utterance into the trained machine learning model; translating, using the trained machine learning model, the natural language utterance into a logical form; executing the one or more logical forms as a query on a database to retrieve a result for the query; and outputting the result for the natural language utterance.

Some embodiments include a system that includes one or more data processors; and one or more non-transitory computer-readable media storing instructions which, when executed by the one or more processors, cause the one or more processors to perform part or all of the operations and/or methods disclosed herein.

Some embodiments include a computer-program product tangibly embodied in one or more non-transitory machine-readable media, including instructions configured to cause one or more data processors to perform part or all of the operations and/or methods disclosed herein.

The techniques described above and below may be implemented in a number of ways and in a number of contexts. Several example implementations and contexts are provided with reference to the following figures, as described below in more detail. However, the following implementations and contexts are but a few of many.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a simplified block diagram of a distributed environment incorporating an exemplary embodiment.

FIG. 2 is a simplified block diagram of a computing system implementing a master bot according to certain embodiments.

FIG. 3 is a simplified block diagram of a computing system implementing a skill bot according to certain embodiments.

FIG. 4A is a simplified logical flow diagram of a data manufacturing framework for synthesizing synthetic training data based on templates and a synchronous context-free grammar according to certain embodiments.

FIG. 4B is another simplified logical flow diagram of a data manufacturing framework for synthesizing synthetic training data based on templates and a synchronous context-free grammar according to certain embodiments.

FIG. 4C is a simplified logical flow diagram of a data manufacturing framework for synthesizing synthetic training data based on a probabilistic context-free grammar and translator according to certain embodiments.

FIG. 4D is a simplified logical flow diagram of a data manufacturing framework for synthesizing synthetic training data based on tree-to-string translation according to certain embodiments.

FIG. 4E is a simplified diagram showing various aspects of a data manufacturing framework for synthesizing synthetic training data based on tree-to-string translation according to certain embodiments.

FIG. 4F is a simplified block diagram of a model training and deployment system according to certain embodiments.

FIG. 5A illustrates an example process for synthesizing synthetic training data based on templates and a synchronous context-free grammar according to certain embodiments.

FIG. 5B illustrates an example process for synthesizing synthetic training data based on a probabilistic context-free grammar and a translator according to certain embodiments.

FIG. 5C illustrates an example process for synthesizing synthetic training data based on tree-to-string translation according to certain embodiments.

FIG. 5D illustrates an example process for transforming natural language to logical form according to certain embodiments.

FIG. 6 depicts a simplified diagram of a distributed system for implementing various embodiments.

FIG. 7 is a simplified block diagram of one or more components of a system environment by which services provided by one or more components of an embodiment system may be offered as cloud services, in accordance with various embodiments.

FIG. 8 illustrates an example computer system that may be used to implement various embodiments.

DETAILED DESCRIPTION

In the following description, for the purposes of explanation, specific details are set forth in order to provide a thorough understanding of certain embodiments. However, it will be apparent that various embodiments may be practiced without these specific details. The figures and description are not intended to be restrictive. The word “exemplary” is used herein to mean “serving as an example, instance, or illustration.” Any embodiment or design described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments or designs.

Introduction

In recent years, the amount of data powering different industries, and their systems has been increasing exponentially. The majority of business information is managed by relational databases that store, process, and retrieve data. Databases power information systems across multiple industries including retail (e.g., orders, cancellations, refunds), supply chain (e.g., raw materials, stocks, vendors), healthcare (e.g., medical records), and finance (e.g., financial business metrics) to name a few. Additionally, databases power customer support mechanisms, Internet search engines and knowledge bases, and much more. It is imperative for modern data-driven companies to track, in real-time, the states of their companies and their businesses in order to quickly understand and diagnose any emerging issues, trends, or anomalies and take corrective actions. This tracking is usually performed manually by business analysts interfacing with databases using complex queries in declarative query languages like Structured Query Language (SQL).

Although SQL queries that address fundamental business metrics are common, predefined, and incorporated in commercial products that power insights into business metrics, other non-fundamental business metrics or follow-up business metrics must be manually coded by the analysts. Such static interactions between database queries and consumption of the corresponding results require time-consuming manual intervention and result in slow feedback cycles. It is vastly more efficient to have non-technical business leaders directly interact with the analytics tables via natural language queries that abstract away the underlying SQL code. Defining a SQL query requires a strong understanding of database schema and SQL syntax and can quickly get overwhelming for beginners and non-technical stakeholders. Efforts to bridge this communication gap have led to the development of a new type of processing called Natural Language Interface to Database (NLIDB). NLIDB allows users to access database information using natural language inquiries. This natural language database search capability has become more popular over recent years and, as such, companies are developing deep learning approaches for accessing specific databases using natural language. One such approach is natural language to SQL (NL2SQL). NL2SQL seeks to transform natural language statements, requests, and questions (i.e., sentences) to SQL queries so that individuals, including those unfamiliar with SQL, can run unstructured queries against databases. Additionally, NL2SQL also enables digital assistants, such as chatbots, and other similar computational devices interacting with users to improve their responses when an answer or response to a query can be found in different databases with different schema.

However, deep learning approaches for NL2SQL require an enormous amount of training data in order to build accurate models (i.e., models that accurately depict the user's intent in their natural language query in the subsequent SQL query). The conventional approaches have typically ignored this problem and assumed the availability of large, manually curated training datasets (e.g., using crowd sourcing). In most cases, however, gathering and cleaning data is a substantial undertaking that requires a significant amount of time, effort, and money. Moreover, existing NL2SQL approaches attempt to build models that generalize to new and unseen databases, but these approaches do not perform as well on these databases as the databases they were trained with. That is, NL2SQL models built with training data to query one particular database generally do not perform well (i.e., generalize) when those same models are used to access other databases in other domains.

Accordingly, a different approach is needed to address these challenges and others. The techniques described herein provide data manufacturing frameworks for synthesizing synthetic training data to facilitate training a natural language to logical form model (e.g., an NL2SQL model). The synthetic data can be synthesized using one or more data augmentation techniques described in detail throughout. Data augmentation is the process of increasing the amount of data assets (e.g., utterances and their corresponding SQL queries) by modifying existing data assets (e.g., utterances and their corresponding SQL queries) to create new ones. In other words, data augmentation increases the number of examples in the training set while also introducing more variety in what the model sees and learns from. Both these aspects make it more difficult for the model to simply memorize mappings while also encouraging the model to learn general patterns (i.e., generalize). While it may be possible to collect more real-world data, this is much more expensive and time consuming than using the data augmentation techniques described in detail herein.

In one particular aspect, a data manufacturing framework for synthesizing synthetic training data based on templates and a synchronous context-free grammar is provided. In some instances, a method includes accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; generating a plurality of templates, each template of the plurality of templates including a delexicalized version of an utterance in the plurality of utterances and a delexicalized version of a logical form corresponding to the utterance; learning a grammar from the plurality of logical forms, the grammar defining a plurality of production rules for lexicalizing the plurality of templates; generating synthetic training data by parsing each template of the plurality of templates, sampling a database to identify a plurality of sampling components, a lexicalizing each template of the plurality of templates with at least one sampling component of the plurality of sampling components; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.

In another particular aspect, a data manufacturing framework for synthesizing synthetic training data based on a probabilistic context-free grammar and translator is provided. In some instances, a method includes accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; obtaining a pre-trained model trained to translate utterances to logical forms; finetuning the pre-trained model to translate logical forms to utterances, wherein the finetuning is performed using the original training data and generates a finetuned model; generating a set of delexicalized logical forms, each delexicalized logical form of the plurality of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by the finetuned model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.

In another particular aspect, a data manufacturing framework for synthesizing synthetic training data based on tree-to-string translation is provided. In some instances, a method includes accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; generating a set of abstract syntax trees for the plurality of logical forms; generating a set of delexicalized logical forms, each delexicalized logical form of the plurality of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by a tree-to-string model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.

Advantageously, using these various methods, large-scale synthetic data can be synthesized across various domains, which can then be sent through a verification process (e.g., a crowd sourcing platform) before being used to train a natural language to logical form model.

Bot and Analytic Systems

A bot (also referred to as a skill, chatbot, chatterbot, or talkbot) is a computer program that can perform conversations with end users. The bot can generally respond to natural-language messages (e.g., questions or comments) through a messaging application that uses natural-language messages. Enterprises may use one or more bots to communicate with end users through a messaging application. The messaging application may include, for example, over-the-top (OTT) messaging channels (such as Facebook Messenger, Facebook WhatsApp, WeChat, Line, Kik, Telegram, Talk, Skype, Slack, or SMS), virtual private assistants (such as Amazon Dot, Echo, or Show, Google Home, Apple HomePod, etc.), mobile and web app extensions that extend native or hybrid/responsive mobile apps or web applications with chat capabilities, or voice based input (such as devices or apps with interfaces that use Siri, Cortana, Google Voice, or other speech input for interaction).

In some examples, the bot may be associated with a Uniform Resource Identifier (URI). The URI may identify the bot using a string of characters. The URI may be used as a webhook for one or more messaging application systems. The URI may include, for example, a Uniform Resource Locator (URL) or a Uniform Resource Name (URN). The bot may be designed to receive a message (e.g., a hypertext transfer protocol (HTTP) post call message) from a messaging application system. The HTTP post call message may be directed to the URI from the messaging application system. In some examples, the message may be different from a HTTP post call message. For example, the bot may receive a message from a Short Message Service (SMS). While discussion herein refers to communications that the bot receives as a message, it should be understood that the message may be an HTTP post call message, a SMS message, or any other type of communication between two systems.

End users interact with the bot through conversational interactions (sometimes referred to as a conversational user interface (UI)), just as end users interact with other people. In some cases, the conversational interactions may include the end user saying “Hello” to the bot and the bot responding with a “Hi” and asking the end user how it can help. End users also interact with the bot through other types of interactions, such as transactional interactions (e.g., with a banking bot that is at least trained to transfer money from one account to another), informational interactions (e.g., with a human resources bot that is at least trained check the remaining vacation hours the user has), and/or retail interactions (e.g., with a retail bot that is at least trained for discussing returning purchased goods or seeking technical support).

In some examples, the bot may intelligently handle end user interactions without intervention by an administrator or developer of the bot. For example, an end user may send one or more messages to the bot in order to achieve a desired goal. A message may include certain content, such as text, emojis, audio, image, video, or other method of conveying a message. In some examples, the bot may automatically convert content into a standardized form and generate a natural language response. The bot may also automatically prompt the end user for additional input parameters or request other additional information. In some examples, the bot may also initiate communication with the end user, rather than passively responding to end user utterances.

A conversation with a bot may follow a specific conversation flow including multiple states. The flow may define what would happen next based on an input. In some examples, a state machine that includes user defined states (e.g., end user intents) and actions to take in the states or from state to state may be used to implement the bot. A conversation may take different paths based on the end user input, which may impact the decision the bot makes for the flow. For example, at each state, based on the end user input or utterances, the bot may determine the end user's intent in order to determine the appropriate next action to take. As used herein and in the context of an utterance, the term “intent” refers to an intent of the user who provided the utterance. For example, the user may intend to engage the bot in a conversation to order pizza, where the user's intent would be represented through the utterance “order pizza.” A user intent can be directed to a particular task that the user wishes the bot to perform on behalf of the user. Therefore, utterances reflecting the user's intent can be phrased as questions, commands, requests, and the like.

In the context of the configuration of the bot, the term “intent” is also used herein to refer to configuration information for mapping a user's utterance to a specific task/action or category of task/action that the bot can perform. In order to distinguish between the intent of an utterance (i.e., a user intent) and the intent of the bot, the latter is sometimes referred to herein as a “bot intent.” A bot intent may comprise a set of one or more utterances associated with the intent. For instance, an intent for ordering pizza can have various permutations of utterances that express a desire to place an order for pizza. These associated utterances can be used to train an intent classifier of the bot to enable the intent classifier to subsequently determine whether an input utterance from a user matches the order pizza intent. Bot intents may be associated with one or more dialog flows for starting a conversation with the user and in a certain state. For example, the first message for the order pizza intent could be the question “What kind of pizza would you like?” In addition to associated utterances, bot intents may further comprise named entities that relate to the intent. For example, the order pizza intent could include variables or parameters used to perform the task of ordering pizza (e.g., topping 1, topping 2, pizza type, pizza size, pizza quantity, and the like). The value of an entity is typically obtained through conversing with the user.

FIG. 1 is a simplified block diagram of an environment 100 incorporating a chatbot system according to certain embodiments. Environment 100 comprises a digital assistant builder platform (DABP) 102 that enables users 104 of DABP 102 to create and deploy digital assistants or chatbot systems. DABP 102 can be used to create one or more digital assistants (or DAs) or chatbot systems. For example, as shown in FIG. 1 , users 104 representing a particular enterprise can use DABP 102 to create and deploy a digital assistant 106 for users of the particular enterprise. For example, DABP 102 can be used by a bank to create one or more digital assistants for use by the bank's customers. The same DABP 102 platform can be used by multiple enterprises to create digital assistants. As another example, an owner of a restaurant (e.g., a pizza shop) may use DABP 102 to create and deploy a digital assistant that enables customers of the restaurant to order food (e.g., order pizza).

For purposes of this disclosure, a “digital assistant” is a tool that helps users of the digital assistant accomplish various tasks through natural language conversations. A digital assistant can be implemented using software only (e.g., the digital assistant is a digital tool implemented using programs, code, or instructions executable by one or more processors), using hardware, or using a combination of hardware and software. A digital assistant can be embodied or implemented in various physical systems or devices, such as in a computer, a mobile phone, a watch, an appliance, a vehicle, and the like. A digital assistant is also sometimes referred to as a chatbot system. Accordingly, for purposes of this disclosure, the terms digital assistant and chatbot system are interchangeable.

A digital assistant, such as digital assistant 106 built using DABP 102, can be used to perform various tasks via natural language-based conversations between the digital assistant and its users 108. As part of a conversation, a user may provide one or more user inputs 110 to digital assistant 106 and get responses 112 back from digital assistant 106. A conversation can include one or more of inputs 110 and responses 112. Via these conversations, a user can request one or more tasks to be performed by the digital assistant and, in response, the digital assistant is configured to perform the user-requested tasks and respond with appropriate responses to the user.

User inputs 110 are generally in a natural language form and are referred to as utterances. A user utterance 110 can be in text form, such as when a user types in a sentence, a question, a text fragment, or even a single word and provides it as input to digital assistant 106. In some examples, a user utterance 110 can be in audio input or speech form, such as when a user says or speaks something that is provided as input to digital assistant 106. The utterances are typically in a language spoken by the user. For example, the utterances may be in English, or some other language. When an utterance is in speech form, the speech input is converted to text form utterances in that particular language and the text utterances are then processed by digital assistant 106. Various speech-to-text processing techniques may be used to convert a speech or audio input to a text utterance, which is then processed by digital assistant 106. In some examples, the speech-to-text conversion may be done by digital assistant 106 itself.

An utterance, which may be a text utterance or a speech utterance, can be a fragment, a sentence, multiple sentences, one or more words, one or more questions, combinations of the aforementioned types, and the like. Digital assistant 106 is configured to apply natural language understanding (NLU) techniques to the utterance to understand the meaning of the user input. As part of the NLU processing for an utterance, digital assistant 106 is configured to perform processing to understand the meaning of the utterance, which involves identifying one or more intents and one or more entities corresponding to the utterance. Upon understanding the meaning of an utterance, digital assistant 106 may perform one or more actions or operations responsive to the understood meaning or intents. For purposes of this disclosure, it is assumed that the utterances are text utterances that have been provided directly by a user of digital assistant 106 or are the results of conversion of input speech utterances to text form. This however is not intended to be limiting or restrictive in any manner.

For example, a user input may request a pizza to be ordered by providing an utterance such as “I want to order a pizza.” Upon receiving such an utterance, digital assistant 106 is configured to understand the meaning of the utterance and take appropriate actions. The appropriate actions may involve, for example, responding to the user with questions requesting user input on the type of pizza the user desires to order, the size of the pizza, any toppings for the pizza, and the like. The responses provided by digital assistant 106 may also be in natural language form and typically in the same language as the input utterance. As part of generating these responses, digital assistant 106 may perform natural language generation (NLG). For the user ordering a pizza, via the conversation between the user and digital assistant 106, the digital assistant may guide the user to provide all the requisite information for the pizza order, and then at the end of the conversation cause the pizza to be ordered. Digital assistant 106 may end the conversation by outputting information to the user indicating that the pizza has been ordered.

At a conceptual level, digital assistant 106 performs various processing in response to an utterance received from a user. In some examples, this processing involves a series or pipeline of processing steps including, for example, understanding the meaning of the input utterance, determining an action to be performed in response to the utterance, where appropriate causing the action to be performed, generating a response to be output to the user responsive to the user utterance, outputting the response to the user, and the like. The NLU processing can include parsing the received input utterance to understand the structure and meaning of the utterance, refining, and reforming the utterance to develop a better understandable form (e.g., logical form) or structure for the utterance. Generating a response may include using NLG techniques.

The NLU processing performed by a digital assistant, such as digital assistant 106, can include various NLP related tasks such as sentence parsing (e.g., tokenizing, lemmatizing, identifying part-of-speech tags for the sentence, identifying named entities in the sentence, generating dependency trees to represent the sentence structure, splitting a sentence into clauses, analyzing individual clauses, resolving anaphoras, performing chunking, and the like). In certain examples, the NLU processing is performed by digital assistant 106 itself. In some other examples, digital assistant 106 may use other resources to perform portions of the NLU processing. For example, the syntax and structure of an input utterance sentence may be identified by processing the sentence using a parser, a part-of-speech tagger, and/or a NER. In one implementation, for the English language, a parser, a part-of-speech tagger, and a named entity recognizer such as ones provided by the Stanford NLP Group are used for analyzing the sentence structure and syntax. These are provided as part of the Stanford CoreNLP toolkit.

While the various examples provided in this disclosure show utterances in the English language, this is meant only as an example. In certain examples, digital assistant 106 is also capable of handling utterances in languages other than English. Digital assistant 106 may provide subsystems (e.g., components implementing NLU functionality) that are configured for performing processing for different languages. These subsystems may be implemented as pluggable units that can be called using service calls from an NLU core server. This makes the NLU processing flexible and extensible for each language, including allowing different orders of processing. A language pack may be provided for individual languages, where a language pack can register a list of subsystems that can be served from the NLU core server.

A digital assistant, such as digital assistant 106 depicted in FIG. 1 , can be made available or accessible to its users 108 through a variety of different channels, such as but not limited to, via certain applications, via social media platforms, via various messaging services and applications, and other applications or channels. A single digital assistant can have several channels configured for it so that it can be run on and be accessed by different services simultaneously.

A digital assistant or chatbot system generally contains or is associated with one or more skills. In certain embodiments, these skills are individual chatbots (referred to as skill bots) that are configured to interact with users and fulfill specific types of tasks, such as tracking inventory, submitting timecards, creating expense reports, ordering food, checking a bank account, making reservations, buying a widget, and the like. For example, for the embodiment depicted in FIG. 1 , digital assistant or chatbot system 106 includes skills 116-1, 116-2, 116-3, and so on. For purposes of this disclosure, the terms “skill” and “skills” are used synonymously with the terms “skill bot” and “skill bots,” respectively.

Each skill associated with a digital assistant helps a user of the digital assistant complete a task through a conversation with the user, where the conversation can include a combination of text or audio inputs provided by the user and responses provided by the skill bots. These responses may be in the form of text or audio messages to the user and/or using simple user interface elements (e.g., select lists) that are presented to the user for the user to make selections.

There are various ways in which a skill or skill bot can be associated or added to a digital assistant. In some instances, a skill bot can be developed by an enterprise and then added to a digital assistant using DABP 102. In other instances, a skill bot can be developed and created using DABP 102 and then added to a digital assistant created using DABP 102. In yet other instances, DABP 102 provides an online digital store (referred to as a “skills store”) that offers multiple skills directed to a wide range of tasks. The skills offered through the skills store may also expose various cloud services. In order to add a skill to a digital assistant being generated using DABP 102, a user of DABP 102 can access the skills store via DABP 102, select a desired skill, and indicate that the selected skill is to be added to the digital assistant created using DABP 102. A skill from the skills store can be added to a digital assistant as is or in a modified form (for example, a user of DABP 102 may select and clone a particular skill bot provided by the skills store, make customizations or modifications to the selected skill bot, and then add the modified skill bot to a digital assistant created using DABP 102).

Various different architectures may be used to implement a digital assistant or chatbot system. For example, in certain embodiments, the digital assistants created and deployed using DABP 102 may be implemented using a master bot/child (or sub) bot paradigm or architecture. According to this paradigm, a digital assistant is implemented as a master bot that interacts with one or more child bots that are skill bots. For example, in the embodiment depicted in FIG. 1 , digital assistant 106 comprises a master bot 114 and skill bots 116-1, 116-2, etc. that are child bots of master bot 114. In certain examples, digital assistant 106 is itself considered to act as the master bot.

A digital assistant implemented according to the master-child bot architecture enables users of the digital assistant to interact with multiple skills through a unified user interface, namely via the master bot. When a user engages with a digital assistant, the user input is received by the master bot. The master bot then performs processing to determine the meaning of the user input utterance. The master bot then determines whether the task requested by the user in the utterance can be handled by the master bot itself, else the master bot selects an appropriate skill bot for handling the user request and routes the conversation to the selected skill bot. This enables a user to converse with the digital assistant through a common single interface and still provide the capability to use several skill bots configured to perform specific tasks. For example, for a digital assistance developed for an enterprise, the master bot of the digital assistant may interface with skill bots with specific functionalities, such as a customer relationship management (CRM) bot for performing functions related to customer relationship management, an enterprise resource planning (ERP) bot for performing functions related to enterprise resource planning, a human capital management (HCM) bot for performing functions related to human capital management, etc. This way the end user or consumer of the digital assistant need only know how to access the digital assistant through the common master bot interface and behind the scenes multiple skill bots are provided for handling the user request.

In certain examples, in a master bot/child bots infrastructure, the master bot is configured to be aware of the available list of skill bots. The master bot may have access to metadata that identifies the various available skill bots, and for each skill bot, the capabilities of the skill bot including the tasks that can be performed by the skill bot. Upon receiving a user request in the form of an utterance, the master bot is configured to, from the multiple available skill bots, identify or predict a specific skill bot that can best serve or handle the user request. The master bot then routes the utterance (or a portion of the utterance) to that specific skill bot for further handling. Control thus flows from the master bot to the skill bots. The master bot can support multiple input and output channels. In certain examples, routing may be performed with the aid of processing performed by one or more available skill bots. For example, as discussed below, a skill bot can be trained to infer an intent for an utterance and to determine whether the inferred intent matches an intent with which the skill bot is configured. Thus, the routing performed by the master bot can involve the skill bot communicating to the master bot an indication of whether the skill bot has been configured with an intent suitable for handling the utterance.

While the embodiment in FIG. 1 shows digital assistant 106 comprising a master bot 114 and skill bots 116-1, 116-2, and 116-3, this is not intended to be limiting. A digital assistant can include various other components (e.g., other systems and subsystems) that provide the functionalities of the digital assistant. These systems and subsystems may be implemented only in software (e.g., code, instructions stored on a computer-readable medium and executable by one or more processors), in hardware only, or in implementations that use a combination of software and hardware.

DABP 102 provides an infrastructure and various services and features that enable a user of DABP 102 to create a digital assistant including one or more skill bots associated with the digital assistant. In some instances, a skill bot can be created by cloning an existing skill bot, for example, cloning a skill bot provided by the skills store. As previously indicated, DABP 102 provides a skills store or skills catalog that offers multiple skill bots for performing various tasks. A user of DABP 102 can clone a skill bot from the skills store. As needed, modifications or customizations may be made to the cloned skill bot. In some other instances, a user of DABP 102 created a skill bot from scratch using tools and services offered by DABP 102. As previously indicated, the skills store or skills catalog provided by DABP 102 may offer multiple skill bots for performing various tasks.

In certain examples, at a high level, creating or customizing a skill bot involves the following steps:

(1) Configuring settings for a new skill bot

(2) Configuring one or more intents for the skill bot

(3) Configuring one or more entities for one or more intents

(4) Training the skill bot

(5) Creating a dialog flow for the skill bot

(6) Adding custom components to the skill bot as needed

(7) Testing and deploying the skill bot

-   Each of the above steps is briefly described below.

(1) Configuring settings for a new skill bot—Various settings may be configured for the skill bot. For example, a skill bot designer can specify one or more invocation names for the skill bot being created. These invocation names can then be used by users of a digital assistant to explicitly invoke the skill bot. For example, a user can input an invocation name in the user's utterance to explicitly invoke the corresponding skill bot.

(2) Configuring one or more intents and associated example utterances for the skill bot—The skill bot designer specifies one or more intents (also referred to as bot intents) for a skill bot being created. The skill bot is then trained based upon these specified intents. These intents represent categories or classes that the skill bot is trained to infer for input utterances. Upon receiving an utterance, a trained skill bot infers an intent for the utterance, where the inferred intent is selected from the predefined set of intents used to train the skill bot. The skill bot then takes an appropriate action responsive to an utterance based upon the intent inferred for that utterance. In some instances, the intents for a skill bot represent tasks that the skill bot can perform for users of the digital assistant. Each intent is given an intent identifier or intent name. For example, for a skill bot trained for a bank, the intents specified for the skill bot may include “CheckBalance,” “TransferMoney,” “DepositCheck,” and the like.

For each intent defined for a skill bot, the skill bot designer may also provide one or more example utterances that are representative of and illustrate the intent. These example utterances are meant to represent utterances that a user may input to the skill bot for that intent. For example, for the CheckBalance intent, example utterances may include “What's my savings account balance?”, “How much is in my checking account?”, “How much money do I have in my account,” and the like. Accordingly, various permutations of typical user utterances may be specified as example utterances for an intent.

The intents and their associated example utterances are used as training data to train the skill bot. Various different training techniques may be used. As a result of this training, a predictive model is generated that is configured to take an utterance as input and output an intent inferred for the utterance by the predictive model. In some instances, input utterances are provided to an intent analysis engine, which is configured to use the trained model to predict or infer an intent for the input utterance. The skill bot may then take one or more actions based upon the inferred intent.

(3) Configuring entities for one or more intents of the skill bot—In some instances, additional context may be needed to enable the skill bot to properly respond to a user utterance. For example, there may be situations where a user input utterance resolves to the same intent in a skill bot. For instance, in the above example, utterances “What's my savings account balance?” and “How much is in my checking account?” both resolve to the same CheckBalance intent, but these utterances are different requests asking for different things. To clarify such requests, one or more entities are added to an intent. Using the banking skill bot example, an entity called AccountType, which defines values called “checking” and “saving” may enable the skill bot to parse the user request and respond appropriately. In the above example, while the utterances resolve to the same intent, the value associated with the AccountType entity is different for the two utterances. This enables the skill bot to perform possibly different actions for the two utterances in spite of them resolving to the same intent. One or more entities can be specified for certain intents configured for the skill bot. Entities are thus used to add context to the intent itself. Entities help describe an intent more fully and enable the skill bot to complete a user request.

In certain examples, there are two types of entities: (a) built-in entities provided by DABP 102, and (2) custom entities that can be specified by a skill bot designer. Built-in entities are generic entities that can be used with a wide variety of bots. Examples of built-in entities include, without limitation, entities related to time, date, addresses, numbers, email addresses, duration, recurring time periods, currencies, phone numbers, URLs, and the like. Custom entities are used for more customized applications. For example, for a banking skill, an AccountType entity may be defined by the skill bot designer that enables various banking transactions by checking the user input for keywords like checking, savings, and credit cards, etc.

(4) Training the skill bot—A skill bot is configured to receive user input in the form of utterances parse or otherwise process the received input and identify or select an intent that is relevant to the received user input. As indicated above, the skill bot has to be trained for this. In certain embodiments, a skill bot is trained based upon the intents configured for the skill bot and the example utterances associated with the intents (collectively, the training data), so that the skill bot can resolve user input utterances to one of its configured intents. In certain examples, the skill bot uses a predictive model that is trained using the training data and allows the skill bot to discern what users say (or in some cases, are trying to say). DABP 102 provides various different training techniques that can be used by a skill bot designer to train a skill bot, including various machine-learning based training techniques, rules-based training techniques, and/or combinations thereof. In certain examples, a portion (e.g., 80%) of the training data is used to train a skill bot model and another portion (e.g., the remaining 20%) is used to test or verify the model. Once trained, the trained model (also sometimes referred to as the trained skill bot) can then be used to handle and respond to user utterances. In certain cases, a user's utterance may be a question that requires only a single answer and no further conversation. In order to handle such situations, a Q&A (question-and-answer) intent may be defined for a skill bot. This enables a skill bot to output replies to user requests without having to update the dialog definition. Q&A intents are created in a similar manner as regular intents. The dialog flow for Q&A intents can be different from that for regular intents.

(5) Creating a dialog flow for the skill bot—A dialog flow specified for a skill bot describes how the skill bot reacts as different intents for the skill bot are resolved responsive to received user input. The dialog flow defines operations or actions that a skill bot will take, e.g., how the skill bot responds to user utterances, how the skill bot prompts users for input, how the skill bot returns data. A dialog flow is like a flowchart that is followed by the skill bot. The skill bot designer specifies a dialog flow using a language, such as markdown language. In certain embodiments, a version of YAML called OBotML may be used to specify a dialog flow for a skill bot. The dialog flow definition for a skill bot acts as a model for the conversation itself, one that lets the skill bot designer choreograph the interactions between a skill bot and the users that the skill bot services.

In certain examples, the dialog flow definition for a skill bot contains three sections:

(a) a context section

(b) a default transitions section

(c) a states section

Context section—The skill bot designer can define variables that are used in a conversation flow in the context section. Other variables that may be named in the context section include, without limitation: variables for error handling, variables for built-in or custom entities, user variables that enable the skill bot to recognize and persist user preferences, and the like.

Default transitions section—Transitions for a skill bot can be defined in the dialog flow states section or in the default transitions section. The transitions defined in the default transition section act as a fallback and get triggered when there are no applicable transitions defined within a state, or the conditions required to trigger a state transition cannot be met. The default transitions section can be used to define routing that allows the skill bot to gracefully handle unexpected user actions.

States section—A dialog flow and its related operations are defined as a sequence of transitory states, which manage the logic within the dialog flow. Each state node within a dialog flow definition names a component that provides the functionality needed at that point in the dialog. States are thus built around the components. A state contains component-specific properties and defines the transitions to other states that get triggered after the component executes.

Special case scenarios may be handled using the states sections. For example, there might be times when you want to provide users the option to temporarily leave a first skill, they are engaged with to do something in a second skill within the digital assistant. For example, if a user is engaged in a conversation with a shopping skill (e.g., the user has made some selections for purchase), the user may want to jump to a banking skill (e.g., the user may want to ensure that he/she has enough money for the purchase), and then return to the shopping skill to complete the user's order. To address this, an action in the first skill can be configured to initiate an interaction with the second different skill in the same digital assistant and then return to the original flow.

(6) Adding custom components to the skill bot—As described above, states specified in a dialog flow for skill bot name components that provide the functionality needed corresponding to the states. Components enable a skill bot to perform functions. In certain embodiments, DABP 102 provides a set of preconfigured components for performing a wide range of functions. A skill bot designer can select one of more of these preconfigured components and associate them with states in the dialog flow for a skill bot. The skill bot designer can also create custom or new components using tools provided by DABP 102 and associate the custom components with one or more states in the dialog flow for a skill bot.

(7) Testing and deploying the skill bot—DABP 102 provides several features that enable the skill bot designer to test a skill bot being developed. The skill bot can then be deployed and included in a digital assistant.

While the description above describes how to create a skill bot, similar techniques may also be used to create a digital assistant (or the master bot). At the master bot or digital assistant level, built-in system intents may be configured for the digital assistant. These built-in system intents are used to identify general tasks that the digital assistant itself (i.e., the master bot) can handle without invoking a skill bot associated with the digital assistant. Examples of system intents defined for a master bot include: (1) Exit: applies when the user signals the desire to exit the current conversation or context in the digital assistant; (2) Help: applies when the user asks for help or orientation; and (3) Unresolved Intent: applies to user input that doesn't match well with the exit and help intents. The digital assistant also stores information about the one or more skill bots associated with the digital assistant. This information enables the master bot to select a particular skill bot for handling an utterance.

At the master bot or digital assistant level, when a user inputs a phrase or utterance to the digital assistant, the digital assistant is configured to perform processing to determine how to route the utterance and the related conversation. The digital assistant determines this using a routing model, which can be rules-based, AI-based, or a combination thereof. The digital assistant uses the routing model to determine whether the conversation corresponding to the user input utterance is to be routed to a particular skill for handling, is to be handled by the digital assistant or master bot itself per a built-in system intent or is to be handled as a different state in a current conversation flow.

In certain embodiments, as part of this processing, the digital assistant determines if the user input utterance explicitly identifies a skill bot using its invocation name. If an invocation name is present in the user input, then it is treated as explicit invocation of the skill bot corresponding to the invocation name. In such a scenario, the digital assistant may route the user input to the explicitly invoked skill bot for further handling. If there is no specific or explicit invocation, in certain embodiments, the digital assistant evaluates the received user input utterance and computes confidence scores for the system intents and the skill bots associated with the digital assistant. The score computed for a skill bot or system intent represents how likely the user input is representative of a task that the skill bot is configured to perform or is representative of a system intent. Any system intent or skill bot with an associated computed confidence score exceeding a threshold value (e.g., a Confidence Threshold routing parameter) is selected as a candidate for further evaluation. The digital assistant then selects, from the identified candidates, a particular system intent or a skill bot for further handling of the user input utterance. In certain embodiments, after one or more skill bots are identified as candidates, the intents associated with those candidate skills are evaluated (according to the intent model for each skill) and confidence scores are determined for each intent. In general, any intent that has a confidence score exceeding a threshold value (e.g., 70%) is treated as a candidate intent. If a particular skill bot is selected, then the user utterance is routed to that skill bot for further processing. If a system intent is selected, then one or more actions are performed by the master bot itself according to the selected system intent.

FIG. 2 is a simplified block diagram of a master bot (MB) system 200 according to certain embodiments. MB system 200 can be implemented in software only, hardware only, or a combination of hardware and software. MB system 200 includes a pre-processing subsystem 210, a multiple intent subsystem (MIS) 220, an explicit invocation subsystem (EIS) 230, a skill bot invoker 240, and a data store 250. MB system 200 depicted in FIG. 2 is merely an example of an arrangement of components in a master bot. One of ordinary skill in the art would recognize many possible variations, alternatives, and modifications. For example, in some implementations, MB system 200 may have more or fewer systems or components than those shown in FIG. 2 , may combine two or more subsystems, or may have a different configuration or arrangement of subsystems.

Pre-processing subsystem 210 receives an utterance “A” 202 from a user and processes the utterance through a language detector 212 and a language parser 214. As indicated above, an utterance can be provided in various ways including audio or text. The utterance 202 can be a sentence fragment, a complete sentence, multiple sentences, and the like. Utterance 202 can include punctuation. For example, if the utterance 202 is provided as audio, the pre-processing subsystem 210 may convert the audio to text using a speech-to-text converter (not shown) that inserts punctuation marks into the resulting text, e.g., commas, semicolons, periods, etc.

Language detector 212 detects the language of the utterance 202 based on the text of the utterance 202. The manner in which the utterance 202 is handled depends on the language since each language has its own grammar and semantics. Differences between languages are taken into consideration when analyzing the syntax and structure of an utterance.

Language parser 214 parses the utterance 202 to extract part of speech (POS) tags for individual linguistic units (e.g., words) in the utterance 202. POS tags include, for example, noun (NN), pronoun (PN), verb (VB), and the like. Language parser 214 may also tokenize the linguistic units of the utterance 202 (e.g., to convert each word into a separate token) and lemmatize words. A lemma is the main form of a set of words as represented in a dictionary (e.g., “run” is the lemma for run, runs, ran, running, etc.). Other types of pre-processing that the language parser 214 can perform include chunking of compound expressions, e.g., combining “credit” and “card” into a single expression “credit card.” Language parser 214 may also identify relationships between the words in the utterance 202. For example, in some embodiments, the language parser 214 generates a dependency tree that indicates which part of the utterance (e.g., a particular noun) is a direct object, which part of the utterance is a preposition, and so on. The results of the processing performed by the language parser 214 form extracted information 205 and are provided as input to MIS 220 together with the utterance 202 itself.

As indicated above, the utterance 202 can include more than one sentence. For purposes of detecting multiple intents and explicit invocation, the utterance 202 can be treated as a single unit even if it includes multiple sentences. However, in certain embodiments, pre-processing can be performed, e.g., by the pre-processing subsystem 210, to identify a single sentence among multiple sentences for multiple intents analysis and explicit invocation analysis. In general, the results produced by MIS 220 and EIS 230 are substantially the same regardless of whether the utterance 202 is processed at the level of an individual sentence or as a single unit comprising multiple sentences.

MIS 220 determines whether the utterance 202 represents multiple intents. Although MIS 220 can detect the presence of multiple intents in the utterance 202, the processing performed by MIS 220 does not involve determining whether the intents of the utterance 202 match to any intents that have been configured for a bot. Instead, processing to determine whether an intent of the utterance 202 matches a bot intent can be performed by an intent classifier 242 of the MB system 200 or by an intent classifier of a skill bot (e.g., as shown in FIG. 3 ). The processing performed by MIS 220 assumes that there exists a bot (e.g., a particular skill bot or the master bot itself) that can handle the utterance 202. Therefore, the processing performed by MIS 220 does not require knowledge of what bots are in the chatbot system (e.g., the identities of skill bots registered with the master bot) or knowledge of what intents have been configured for a particular bot.

To determine that the utterance 202 includes multiple intents, the MIS 220 applies one or more rules from a set of rules 252 in the data store 250. The rules applied to the utterance 202 depend on the language of the utterance 202 and may include sentence patterns that indicate the presence of multiple intents. For example, a sentence pattern may include a coordinating conjunction that joins two parts (e.g., conjuncts) of a sentence, where both parts correspond to a separate intent. If the utterance 202 matches the sentence pattern, it can be inferred that the utterance 202 represents multiple intents. It should be noted that an utterance with multiple intents does not necessarily have different intents (e.g., intents directed to different bots or to different intents within the same bot). Instead, the utterance could have separate instances of the same intent (e.g. “Place a pizza order using payment account X, then place a pizza order using payment account Y”).

As part of determining that the utterance 202 represents multiple intents, the MIS 220 also determines what portions of the utterance 202 are associated with each intent. MIS 220 constructs, for each intent represented in an utterance containing multiple intents, a new utterance for separate processing in place of the original utterance, e.g., an utterance “B” 206 and an utterance “C” 208, as depicted in FIG. 2 . Thus, the original utterance 202 can be split into two or more separate utterances that are handled one at a time. MIS 220 determines, using the extracted information 205 and/or from analysis of the utterance 202 itself, which of the two or more utterances should be handled first. For example, MIS 220 may determine that the utterance 202 contains a marker word indicating that a particular intent should be handled first. The newly formed utterance corresponding to this particular intent (e.g., one of utterance 206 or utterance 208) will be the first to be sent for further processing by EIS 230. After a conversation triggered by the first utterance has ended (or has been temporarily suspended), the next highest priority utterance (e.g., the other one of utterance 206 or utterance 208) can then be sent to the EIS 230 for processing.

EIS 230 determines whether the utterance that it receives (e.g., utterance 206 or utterance 208) contains an invocation name of a skill bot. In certain embodiments, each skill bot in a chatbot system is assigned a unique invocation name that distinguishes the skill bot from other skill bots in the chatbot system. A list of invocation names can be maintained as part of skill bot information 254 in data store 250. An utterance is deemed to be an explicit invocation when the utterance contains a word match to an invocation name. If a bot is not explicitly invoked, then the utterance received by the EIS 230 is deemed a non-explicitly invoking utterance 234 and is input to an intent classifier (e.g., intent classifier 242) of the master bot to determine which bot to use for handling the utterance. In some instances, the intent classifier 242 will determine that the master bot should handle a non-explicitly invoking utterance. In other instances, the intent classifier 242 will determine a skill bot to route the utterance to for handling.

The explicit invocation functionality provided by the EIS 230 has several advantages. It can reduce the amount of processing that the master bot has to perform. For example, when there is an explicit invocation, the master bot may not have to do any intent classification analysis (e.g., using the intent classifier 242), or may have to do reduced intent classification analysis for selecting a skill bot. Thus, explicit invocation analysis may enable selection of a particular skill bot without resorting to intent classification analysis.

Also, there may be situations where there is an overlap in functionalities between multiple skill bots. This may happen, for example, if the intents handled by the two skill bots overlap or are very close to each other. In such a situation, it may be difficult for the master bot to identify which of the multiple skill bots to select based upon intent classification analysis alone. In such scenarios, the explicit invocation disambiguates the particular skill bot to be used.

In addition to determining that an utterance is an explicit invocation, the EIS 230 is responsible for determining whether any portion of the utterance should be used as input to the skill bot being explicitly invoked. In particular, EIS 230 can determine whether part of the utterance is not associated with the invocation. The EIS 230 can perform this determination through analysis of the utterance and/or analysis of the extracted information 205. EIS 230 can send the part of the utterance not associated with the invocation to the invoked skill bot in lieu of sending the entire utterance that was received by the EIS 230. In some instances, the input to the invoked skill bot is formed simply by removing any portion of the utterance associated with the invocation. For example, “I want to order pizza using Pizza Bot” can be shortened to “I want to order pizza” since “using Pizza Bot” is relevant to the invocation of the pizza bot, but irrelevant to any processing to be performed by the pizza bot. In some instances, EIS 230 may reformat the part to be sent to the invoked bot, e.g., to form a complete sentence. Thus, the EIS 230 determines not only that there is an explicit invocation, but also what to send to the skill bot when there is an explicit invocation. In some instances, there may not be any text to input to the bot being invoked. For example, if the utterance was “Pizza Bot”, then the EIS 230 could determine that the pizza bot is being invoked, but there is no text to be processed by the pizza bot. In such scenarios, the EIS 230 may indicate to the skill bot invoker 240 that there is nothing to send.

Skill bot invoker 240 invokes a skill bot in various ways. For instance, skill bot invoker 240 can invoke a bot in response to receiving an indication 235 that a particular skill bot has been selected as a result of an explicit invocation. The indication 235 can be sent by the EIS 230 together with the input for the explicitly invoked skill bot. In this scenario, the skill bot invoker 240 will turn control of the conversation over to the explicitly invoked skill bot. The explicitly invoked skill bot will determine an appropriate response to the input from the EIS 230 by treating the input as a stand-alone utterance. For example, the response could be to perform a specific action or to start a new conversation in a particular state, where the initial state of the new conversation depends on the input sent from the EIS 230.

Another way in which skill bot invoker 240 can invoke a skill bot is through implicit invocation using the intent classifier 242. The intent classifier 242 can be trained, using machine-learning and/or rules-based training techniques, to determine a likelihood that an utterance is representative of a task that a particular skill bot is configured to perform. The intent classifier 242 is trained on different classes, one class for each skill bot. For instance, whenever a new skill bot is registered with the master bot, a list of example utterances associated with the new skill bot can be used to train the intent classifier 242 to determine a likelihood that a particular utterance is representative of a task that the new skill bot can perform. The parameters produced as result of this training (e.g., a set of values for parameters of a machine-learning model) can be stored as part of skill bot information 254.

In certain embodiments, the intent classifier 242 is implemented using a machine-learning model, as described in further detail herein. Training of the machine-learning model may involve inputting at least a subset of utterances from the example utterances associated with various skill bots to generate, as an output of the machine-learning model, inferences as to which bot is the correct bot for handling any particular training utterance. For each training utterance, an indication of the correct bot to use for the training utterance may be provided as ground truth information. The behavior of the machine-learning model can then be adapted (e.g., through back-propagation) to minimize the difference between the generated inferences and the ground truth information.

In certain embodiments, the intent classifier 242 determines, for each skill bot registered with the master bot, a confidence score indicating a likelihood that the skill bot can handle an utterance (e.g., the non-explicitly invoking utterance 234 received from EIS 230). The intent classifier 242 may also determine a confidence score for each system level intent (e.g., help, exit) that has been configured. If a particular confidence score meets one or more conditions, then the skill bot invoker 240 will invoke the bot associated with the particular confidence score. For example, a threshold confidence score value may need to be met. Thus, an output 245 of the intent classifier 242 is either an identification of a system intent or an identification of a particular skill bot. In some embodiments, in addition to meeting a threshold confidence score value, the confidence score must exceed the next highest confidence score by a certain win margin. Imposing such a condition would enable routing to a particular skill bot when the confidence scores of multiple skill bots each exceed the threshold confidence score value.

After identifying a bot based on evaluation of confidence scores, the skill bot invoker 240 hands over processing to the identified bot. In the case of a system intent, the identified bot is the master bot. Otherwise, the identified bot is a skill bot. Further, the skill bot invoker 240 will determine what to provide as input 247 for the identified bot. As indicated above, in the case of an explicit invocation, the input 247 can be based on a part of an utterance that is not associated with the invocation, or the input 247 can be nothing (e.g., an empty string). In the case of an implicit invocation, the input 247 can be the entire utterance.

Data store 250 comprises one or more computing devices that store data used by the various subsystems of the master bot system 200. As explained above, the data store 250 includes rules 252 and skill bot information 254. The rules 252 include, for example, rules for determining, by MIS 220, when an utterance represents multiple intents and how to split an utterance that represents multiple intents. The rules 252 further include rules for determining, by EIS 230, which parts of an utterance that explicitly invokes a skill bot to send to the skill bot. The skill bot information 254 includes invocation names of skill bots in the chatbot system, e.g., a list of the invocation names of all skill bots registered with a particular master bot. The skill bot information 254 can also include information used by intent classifier 242 to determine a confidence score for each skill bot in the chatbot system, e.g., parameters of a machine-learning model.

FIG. 3 is a simplified block diagram of a skill bot system 300 according to certain embodiments. Skill bot system 300 is a computing system that can be implemented in software only, hardware only, or a combination of hardware and software. In certain embodiments such as the embodiment depicted in FIG. 1 , skill bot system 300 can be used to implement one or more skill bots within a digital assistant.

Skill bot system 300 includes an MIS 310, an intent classifier 320, and a conversation manager 330. The MIS 310 is analogous to the MIS 220 in FIG. 2 and provides similar functionality, including being operable to determine, using rules 352 in a data store 350: (1) whether an utterance represents multiple intents and, if so, (2) how to split the utterance into a separate utterance for each intent of the multiple intents. In certain embodiments, the rules applied by MIS 310 for detecting multiple intents and for splitting an utterance are the same as those applied by MIS 220. The MIS 310 receives an utterance 302 and extracted information 304. The extracted information 304 is analogous to the extracted information 205 in FIG. 1 and can be generated using the language parser 214 or a language parser local to the skill bot system 300.

Intent classifier 320 can be trained in a similar manner to the intent classifier 242 discussed above in connection with the embodiment of FIG. 2 and as described in further detail herein. For instance, in certain embodiments, the intent classifier 320 is implemented using a machine-learning model. The machine-learning model of the intent classifier 320 is trained for a particular skill bot, using at least a subset of example utterances associated with that particular skill bot as training utterances. The ground truth for each training utterance would be the particular bot intent associated with the training utterance.

The utterance 302 can be received directly from the user or supplied through a master bot. When the utterance 302 is supplied through a master bot, e.g., as a result of processing through MIS 220 and EIS 230 in the embodiment depicted in FIG. 2 , the MIS 310 can be bypassed so as to avoid repeating processing already performed by MIS 220. However, if the utterance 302 is received directly from the user, e.g., during a conversation that occurs after routing to a skill bot, then MIS 310 can process the utterance 302 to determine whether the utterance 302 represents multiple intents. If so, then MIS 310 applies one or more rules to split the utterance 302 into a separate utterance for each intent, e.g., an utterance “D” 306 and an utterance “E” 308. If utterance 302 does not represent multiple intents, then MIS 310 forwards the utterance 302 to intent classifier 320 for intent classification and without splitting the utterance 302.

Intent classifier 320 is configured to match a received utterance (e.g., utterance 306 or 308) to an intent associated with skill bot system 300. As explained above, a skill bot can be configured with one or more intents, each intent including at least one example utterance that is associated with the intent and used for training a classifier. In the embodiment of FIG. 2 , the intent classifier 242 of the master bot system 200 is trained to determine confidence scores for individual skill bots and confidence scores for system intents. Similarly, intent classifier 320 can be trained to determine a confidence score for each intent associated with the skill bot system 300. Whereas the classification performed by intent classifier 242 is at the bot level, the classification performed by intent classifier 320 is at the intent level and therefore finer grained. The intent classifier 320 has access to intents information 354. The intents information 354 includes, for each intent associated with the skill bot system 300, a list of utterances that are representative of and illustrate the meaning of the intent and are typically associated with a task performable by that intent. The intents information 354 can further include parameters produced as a result of training on this list of utterances.

Conversation manager 330 receives, as an output of intent classifier 320, an indication 322 of a particular intent, identified by the intent classifier 320, as best matching the utterance that was input to the intent classifier 320. In some instances, the intent classifier 320 is unable to determine any match. For example, the confidence scores computed by the intent classifier 320 could fall below a threshold confidence score value if the utterance is directed to a system intent or an intent of a different skill bot. When this occurs, the skill bot system 300 may refer the utterance to the master bot for handling, e.g., to route to a different skill bot. However, if the intent classifier 320 is successful in identifying an intent within the skill bot, then the conversation manager 330 will initiate a conversation with the user.

The conversation initiated by the conversation manager 330 is a conversation specific to the intent identified by the intent classifier 320. For instance, the conversation manager 330 may be implemented using a state machine configured to execute a dialog flow for the identified intent. The state machine can include a default starting state (e.g., for when the intent is invoked without any additional input) and one or more additional states, where each state has associated with it actions to be performed by the skill bot (e.g., executing a purchase transaction) and/or dialog (e.g., questions, responses) to be presented to the user. Thus, the conversation manager 330 can determine an action/dialog 335 upon receiving the indication 322 identifying the intent and can determine additional actions or dialog in response to subsequent utterances received during the conversation.

Data store 350 comprises one or more computing devices that store data used by the various subsystems of the skill bot system 300. As depicted in FIG. 3 , the data store 350 includes the rules 352 and the intents information 354. In certain embodiments, data store 350 can be integrated into a data store of a master bot or digital assistant, e.g., the data store 250 in FIG. 2 .

Data Manufacturing Frameworks for Synthesizing Synthetic Training Data

Building a deep learning model that can transform a user's natural language query into a SQL query that matches the user's intent requires an enormous amount of training data. Additionally, building such a model that can generalize well to new and unseen databases is difficult because training data is usually domain-specific (i.e., designed for one particular database and/or application). Conventional approaches have assumed that large amounts of manually curated (e.g., using crowdsourcing) non-domain-specific training data is and/or will be available. However, gathering and curating such data is a substantial undertaking that requires a significant amount of time, effort, and costs. To overcome these challenges and others, data manufacturing frameworks are described herein for synthesizing synthetic training data to facilitate training a natural language to logical form model (e.g., an NL2SQL model).

In some instances, the natural language to logical form model (also described herein as a semantic parsing model) trained with the synthetic training data synthesized using the techniques described herein can be implemented in a chatbot system, as described with respect to FIGS. 1, 2 and 3 . Nonetheless, while the data manufacturing frameworks are described in various instances herein with particular reference to natural language to logical form (such as SQL) and/or a chatbot system, it should be understood that these frameworks are applicable for other semantic parsing models (e.g., natural language to Python, Java, etc.) and/or artificial-intelligence based systems where a developer/user is interested in understanding a user's natural language utterance. Furthermore, herein, SQL queries are provided as examples of logical forms corresponding to utterances in training data; however, any kind of logical form may be included in the training data, according to various embodiments.

Framework Based on Templates and a Synchronous Context-Free Grammar

Synthetic training data that includes natural language (NL) utterances and corresponding SQL queries can be generated under a data manufacturing framework based on templates and a synchronous context-free grammar (SCFG). The data manufacturing framework can generate the synthetic training data by accessing original training data that includes NL utterances and corresponding SQL queries, generating templates and learning a SCFG from the original training data, generating lexicalized training data (i.e., the synthetic training data) by lexicalizing the templates. In order to lexicalize the templates, templates can be parsed and analyzed based on the SCFG, a relational database can be analyzed and sampled, the parsed templates can be populated with sampled database components to generate lexicalized training examples, and the lexicalized training examples can be validated to output the lexicalized training data. The original training data can be combined with the synthetic training data to form updated training data. In some instances, prior to combining the original training data and the synthetic training data, the lexicalized training data can be paraphrased to form paraphrased lexicalized training data which can be combined with the original training data to form the updated training data.

FIG. 4A is a simplified logical flow diagram 4100 of an example process for generating training data under a data manufacturing framework based on templates and a SCFG. The flow starts with accessing training data 4102 (i.e., original training data). The training data 4102 can be obtained from one or more sources such as a database (not shown). The training data 4102 can include utterances and their corresponding SQL queries. For example, the training data 4102 can include the utterance “What is the average life expectancy in the United States of America?” and its corresponding SQL query “SELECT AVG(life_expectancy) FROM T1 WHERE country=‘United States of America’”. In some instances, each utterance can be labeled with a label indicating that it is an utterance, and its corresponding SQL query can be labeled with a label indicating that it is a SQL query and the utterance it corresponds to. For example, the utterance “How many square miles is the United States of America?” can be labeled with the label “first utterance” and its corresponding SQL “SELECT size FROM T1 WHERE country=‘United States of America’” can be labeled with the label “first SQL query, first utterance”.

In some instances, the utterances and their corresponding SQL queries can pertain to a part or parts of a conversation (e.g., a conversation between users and/or between a user and a machine such as the chatbot described above). In some instances, the utterances and their corresponding SQL queries can be non-follow-up utterances and corresponding non-follow-up SQL queries and/or follow-up utterances and corresponding follow-up SQL queries. Non-follow-up utterances and corresponding SQL queries refers to initial utterances and corresponding SQL queries in sequences of utterances and corresponding SQL queries, and follow-up utterances and corresponding SQL queries refers to subsequent utterances and corresponding SQL queries in the sequences of utterances and corresponding SQL queries. In some instances, the utterances and their corresponding SQL queries can pertain to a single relational database or domain and/or multiple relational databases or domains.

The training data 4102 can also include database schema information. A database schema defines how data is organized within a database such as a relational database; this includes logical constraints such as table names, fields, data types, and the relationships between these entities. A relational database can be formed of one or more tables with each table of the one or more tables including one or more columns with each column of the one or more columns including one or more values. Each table and column of a relational database can be named with unique identifiers, each of which can include one or more words. In some instances, one or more columns of the relational database may serve as a primary key in which each of the values of the one or more columns that serve as the primary key are unique from each other. In some instances, one or more columns of the relational database may serve as a foreign key which serves to the link the table which includes the one or more columns with another table in the relational database. In some instances, a table or column that does not reference another table or column can be considered a terminal table or column and a table or column that references another table or column can be a non-terminal table or column. In some instances, the database schema information includes one or more data structures for storing the unique identifiers of the one or more tables, the unique identifiers of the one or more columns, and values of each relational database. The unique identifiers and values can be stored in one or more vectors and/or matrices. In some embodiments, a data structure storing schema information for a relational database can store a directed graph representing the unique identifiers and values.

In some instances, the training data 4102 can include utterances and their corresponding SQL queries obtained from one or more public datasets such as the Spider, SParC, and/or CoSQL datasets. Additional information for the Spider dataset is found in “Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task” by Yu et al., published in Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing 2018, the entire contents of which are hereby incorporated by reference as if fully set forth herein. Additional information for the SParC dataset is found in “SParC: Cross-Domain Semantic Parsing in Context” by Yu et al., published in Proceedings of the Association for Computational Linguistics 2019, the entire contents of which are hereby incorporated by reference as if fully set forth herein. Additional information for the CoSQL dataset is found in “CoSQL: A Conversational Text-to-SQL Challenge Towards Cross-Domain Natural Language Interfaces to Databases” by Yu et al., published in Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

Upon accessing the training data 4102, an SCFG 4106 can be learned from the training data 4102 at SCFG learning stage 4104 and templates 4110 can be generated at template generation stage 4108. In some instances, at SCFG learning stage 4104, the SCFG 4106 can be learned based on the utterances and database schema information included in the training data 4102. An SCFG refers to a grammar based on a finite set of synchronous rules where each synchronous rule has the general form [A₁→α₁, A₂→α₂], where A₁, A₂ are non-terminals and α₁, α₂ are synchronous strings (i.e., a bijection exists between the occurrences of non-terminals in α₁ and the occurrences of non-terminals in α₂, and that this bijection is explicitly provided by the synchronous rule). Additional information for SCFGs can be found in “An Introduction to Synchronous Grammars” by Chiang, published in Part of a tutorial given at ACL, the entire contents of which are hereby incorporated by reference as if fully set forth herein. In some instances, the SCFG 4106 can be learned by setting the table names, column names, and values in the database schema information as non-terminal symbols, setting SQL operators (e.g., Max, Min, =, Like, etc.) as non-terminal symbols, setting SQL functions (e.g., Average, Count, First, Last, etc.) as non-terminal symbols, and generating production rules by replacing entities/phrases in the utterances in the training data 4102 with the set of non-terminal symbols. Additional information for learning an SCFG for SQL can be found in “Grammar-based Neural Text-to-SQL Generation” by Lin et al., published in arXiv, and “Grappa: Grammar-Augmented Pre-Training For Table Semantic Parsing” by Yu et al., published in ICLR, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

At template generation stage 4108, templates 4110 can be generated from the utterances and their corresponding SQL queries in the training data 4102. A template includes a delexicalized utterance and its corresponding delexicalized SQL query. A delexicalized utterance as used herein refers to an utterance in which entities in the utterance that correspond to the names of the tables, columns, and/or values of one or more relational databases are respectively replaced with non-terminal symbols that represent whether the respective entity corresponds to a table, column, or value. For example, the utterance “How many storms occurred in each region?” can be delexicalized into the delexicalized utterance “How many TABLE#2 occurred in each TABLE#1.COLUMN#0?” by replacing the terms “storms” and “regions,” which respectively correspond to a table name and column name in an exemplary database schema, with corresponding non-terminal symbols. A delexicalized SQL query as used herein refers to a SQL query in which entities in the SQL query that correspond to the names of the tables, columns, and/or values of one or more relational databases are respectively replaced with non-terminal symbols that represent whether the respective entity corresponds to a table, column, or value. For example, delexicalization of the SQL query “SELECT T1.region name, count (*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id=T2.region_id GROUP BY T1.region_id” yields the delexicalized SQL query “SELECT TABLE#0.COLUMN#0, Count (*) FROM TABLE#0 JOIN TABLE#1 ON TABLE#0.COLUMN#1=TABLE#1.COLUMN#0 GROUP BY TABLE#0.COLUMN#1.”

In some instances, at template generation stage 4108, templates 4110 can be generated automatically from the utterances and their corresponding SQL queries in the training data 4102 using a trained machine learning model. In some instances, the machine learning model is trained to perform approximate string matching. In some instances, the trained machine learning model can predict which words in a respective utterance correspond to table names, table column names, and column values in the database schema information included in the training data 4102 and replace those words with the non-terminal symbols. For example, as depicted in the examples above, predicted table names in the respective utterance can be replaced with the non-terminal symbol TABLE, predicted column names in the respective utterance can be replaced with the non-terminal symbol COLUMN, and predicted values in the respective utterance can be replaced with the non-terminal symbol VALUE. In some instances, the non-terminal symbols TABLE, COLUMN, and VALUE can include an index representing a table number or a column number and a hashtag symbol that separates the non-terminal symbol from its index (e.g., TABLE#0.COLUMN#0, TABLE#0). In some instances, the trained machine learning model can include one or more neural networks trained to perform approximate string matching with training data that includes utterances labeled with database schema information. In some instances, templates 4110 generated using a trained machine learning model may not generalize well across databases and may produce inconsistent delexicalized parts in both the utterance and the corresponding SQL query.

Alternatively, or additionally, in some instances, at template generation stage 4108, templates 4110 which can generalize well across databases and include consistent delexicalized parts in both the utterance and the corresponding SQL query can be generated by a user based on a rules scheme. In some instances, in order to generate a template, the user can apply the following rule scheme: 1. non-terminals in the utterance and its corresponding SQL query in the template should be equal (i.e., there should not be a hanging non-terminal in either side); 2. there should not be any lexicalized entities in the template utterance that can cannot generalize well across databases; 3. non-terminals are defined as elements of either table, column, or value of a database schema with an enumeration starting from 0 (i.e., table, column, and value which do not reference another table, column, or value), all column and values should be delexicalized, and a table should be delexicalized only if it is mentioned in the utterance but a column of that table does not appear anywhere in the utterance; 4. all parts of the utterance should be kept if feasible (e.g., do not remove a part of an utterances that corresponds to a SQL operator, but remove verbs of the utterance that hinder generalization of the template); 5. for any identified non-terminal symbol, replace the identified non-terminal symbol with the respective non-terminal symbol in all capital letters followed by a hashtag symbol that separates the non-terminal from its index (e.g., TABLE#0.COLUMN#0, TABLE#0); and 6. check the consistencies of the template and retain any templates that are consistent and discard any templates that are inconsistent.

Upon generating the templates 4110 and the SCFG 4106, at lexicalization stage 4112, the templates 4110 can be lexicalized to generate lexicalized training data 4114. In some instances, as shown in FIG. 4B, at the lexicalization stage 4200, the templates 4110 can be lexicalized using the SCFG 4106. A lexicalized utterance as used herein refers to a delexicalized utterance in which non-terminal symbols of the utterance are replaced with sampled components of a database. For example, the delexicalized utterance “Show all TABLE#0.COLUMN#0 with at least 3 TABLE#0” can be lexicalized into the lexicalized utterance “Show all player attributes shot power with at least 3 player attributes” because “player attributes” is a table in the database and “shot power” is a column in that table. Similarly, a lexicalized SQL query as used herein refers to a delexicalized SQL query in which the non-terminal symbols are replaced with sampled components of a database. For example, the delexicalized SQL query “SELECT TABLE#0.COLUMN#0 FROM TABLE#0 GROUP BY TABLE#0.COLUMN#0 HAVING Count (*)>=3” can be lexicalized into the lexicalized SQL query “SELECT Player_Attributes.shot_power FROM Player_Attributes GROUP BY Player_Attributes.shot_power HAVING Count(*)>=3.0.”

In some instances, in order to generate the lexicalized training data 4114, at template parsing stage 4204, the templates 4110 are parsed to produced parsed templates 4206. In some instances, each parsed template 4206 includes a parsed delexicalized utterance and its corresponding parsed delexicalized SQL query. In some instances, the templates 4110 can be parsed using a parsing algorithm and the SCFG 4106. In some instances, the parsing algorithm can apply the SCFG 4106 to each delexicalized utterance and its corresponding delexicalized SQL query to generate an abstract syntax tree (AST) for each parsed delexicalized utterance and its corresponding parsed delexicalized SQL query in which their respective logical syntactic components are identified and represented in the AST. An AST as used herein refers to a tree representation of the abstract syntactic structure of the delexicalized utterances and their corresponding delexicalized SQL queries. In some instances, the ASTs can be structured in the Zephyr Abstract Syntax Description Language format. Additional information for the Zephyr Abstract Syntax Description Language format can be found in “The Zephyr Abstract Syntax Description Language” by Wang et al., published In Proceedings of the Conference on Domain-Specific Languages on Conference on Domain-Specific Languages (DSL), the entire contents of which are hereby incorporated by reference as if fully set forth herein. For example, for the delexicalized SQL query “SELECT TABLE#0.COLUMN#0 FROM TABLE#0 WHERE TABLE#0.COLUMN#1=‘VALUE#0’”, the following AST can be generated:

{  “_type”: “sql”,  “select”: {   “_type”: “select”,   “is_distinct”: false,   “aggs”: [    {     “_type”: “agg”,     “agg_id”: {      “_type”: “NoneAggOp”     },     “val_unit”: {      “_type”: “Column”,      “col_unit1”: {       “_type”: “col_unit”,       “agg_id”: {        “_type”: “NoneAggOp”       },       “is_distinct”: false,       “col_id”: “_(——)table#0.column#0_(——)”      }     }    }   ]  },  “where”: {   “_type”: “Eq”,   “val_unit”: {    “_type”: “Column”,    “col_unit1”: {     “_type”: “col_unit”,     “agg_id”: {      “_type”: “NoneAggOp”     },     “is_distinct”: false,     “col_id”: “_(——)table#0.column#1_(——)”    }   },   “val 1”: {    “_type”: “String”,    “s”: “\”value#0\”“   }  } }

In some instances, in order to generate the lexicalized training data 4114, at template analysis stage 4208, the constrained sampling stage 4212, and lexicalization stage 4220, the templates 4110 are analyzed to identify one or more constraints in each template, a database 4216 is analyzed to identify its components, database components are sampled based on the identified one or more constraints in each template, and the non-terminal symbols in each delexicalized utterance and its corresponding delexicalized SQL query are replaced with the sampled components. In some instances, at template analysis stage 4208, each delexicalized utterance and its corresponding delexicalized SQL query of the templates 4110 are analyzed to identify each non-terminal symbol in the delexicalized utterance and the delexicalized SQL query. In some instances, each COLUMN non-terminal symbol is mapped to one a plurality of COLUMN types and a constraint of a plurality of constraints is defined for each COLUMN non-terminal symbol based on its respective COLUMN type. In some instances, each VALUE non-terminal symbol is mapped to a corresponding COLUMN non-terminal symbol. In some instances, the plurality of COLUMN types include a TEXT type column in which the values of the column are text, a NUMBER type column in which the values of the column are numbers, a BOOLEAN type column in which the values of the column are Boolean operators, a TIME type column in which the values of the column are timestamps, a CURRENCY type column in which the values of the column are currency values, an AGE type column in which the values of the column are ages. In some instances, the plurality of constraints includes an Aggregateable, a Requestable, a Sortable, a Comparable, an Orderable, a Groupable, and a Filterable constraint. The foregoing column types and constraints are not intended to be limiting and other column types and constraints are possible (see below). In some instances, each COLUMN non-terminal symbol is mapped to one of a plurality of COLUMN types matching the characters of the non-terminal symbol to the characters of the plurality of COLUMN types (e.g., via string-matching) and determining whether a VALUE non-terminal symbol matches the COLUMN type. For example, a COLUMN#0.NUMBER non-terminal symbol can be string-matched to a NUMBER type and the type can be validated by determining whether a VALUE non-terminal symbol corresponds to a number, which is associated with the COLUMN#0 non-terminal symbol, corresponds to a number. The following is an example of a mapping that includes a string-matching name check and a validation check:

Data Type Type Name Check Validation Check Meta Type TEXT — — NUMBER — is_numeric( ) BOOLEAN — true/false/yes/no/t/f/y/n TIME yes — OTHERS — — Custom Type CURRENCY yes — AGE yes is_numeric( ) value_within(1, 150) ENUM no num_rows >= 20 distinct value <= 5 DATE yes — MEASURE_BYTES yes is_numeric( ) MEASURE_WEIGHT yes is_numeric( ) MEASURE_LENGTH yes is_numeric( ) MEASURE_SURFACE yes is_numeric( ) MEASURE_VOLUME yes is_numeric( ) MEASURE_DURATION yes is_numeric( ) PHONE_NUMBER — all samples match phone number (e.g., using regular expressions) LOCATION yes — EMAIL_ADDRESS yes all samples match email (e.g., using regular expressions) URL_ADDRESS — all samples match url (e.g., regular expressions) IP_ADDRESS — all samples match IP address (e.g., using regular expressions) ID yes —

In some instances, at constrained sampling stage 4212, components are sampled from the database 4216 based on a database analysis 4218 of the database 4216 and the analyzed templates 4210. In some instances, the database 4216 is one or more relational databases with each database having components (e.g., tables, columns, and values). In some instances, a database analysis 4218 is performed on the one or more databases 4216 to identify its components. In some instances, the one or more databases 4216 and its components can be obtained from one or more sources such a user or the WikiSQL dataset. Additional information is found in “Seq2sql: Generating structured queries from natural language using reinforcement learning” by Zhong et al., published in CoRR, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

In some instances, components 4214 are sampled from the database 4216 based on the analysis of the non-terminal symbols in the analyzed templates 4210 at the template analysis stage 4208. In some instances, prior to sampling components, each database in the one or more databases 4216 can be analyzed at database analysis stage 4218 to identify the components (e.g., tables and their names, columns and their names, and the values in column) of the respective database. In some instances, database analysis stage 4218 is performed for a database based on schema information for the database. In some instances, in order to sample components for a respective analyzed template of the templates 4210, a database of the one or more databases 4216 can be randomly selected and its components can be sampled and used to lexicalize the respective analyzed template. In some instances, for each respective analyzed template of the templates 4210, a table name is sampled from the selected database 4216 for each TABLE non-terminal symbol in the respective analyzed template 4210, a column name is sampled from the sampled table for each COLUMN non-terminal symbol in the respective analyzed template 4210, and a value is sampled from the sampled column for each VALUE non-terminal symbol in the respective analyzed template 4210. In some instances, for TABLE and COLUMN non-terminal symbols having an index (described), the table and column names can be sampled based on the index value. For example, for a database having two tables and five columns in each table and a TABLE#1.COLUMN#2 non-terminal symbol, the first table and second column in that table can be sampled from the database.

In some instances, the table name can be randomly sampled from the database 4216. For example, a table name can be randomly selected from the database 4216. In some instances, the table name can be sampled from the database 4216 based on the index of a non-terminal symbol (e.g., a table with an index of 1 in the database can be sampled for a TABLE#1 non-terminal symbol.) In some instances, the column name is sampled based on the table to which it belongs, the type of column it is, and its constraints. For example, a column name in the database belonging to a particular table and having numbers as values and requestable as a constraint will be sampled for COLUMN non-terminal symbols having a type NUMBERS and a Requestable constraint. In some instances, when sampling a column name for the utterance, any spaces in the column can be replaced with “_” and any periods (e.g., “.”) can be removed, but, when sampling a column name for the SQL query, the column name is not changed. In some instances, the table names and the column names sampled for non-terminal symbols in the utterance should be the same for the same non-terminal symbols in the SQL query. In other words, there should be a one-to-one mapping between the sampled components for non-terminal symbols in the utterance and the sampled components for the same non-terminal symbols in the SQL query. In some instances, values are sampled by determining whether the VALUE non-terminal symbol is associated with an operator (e.g., <, <=, >, >=, LIKE, etc.) and sampling values from the corresponding column is performed based on the associated operator. For less than and greater than type operators, values are randomly sampled between the minimum values and maximum of the corresponding column. For the LIKE and other operator, values are randomly sampled and the characters at the start, end, and/or a combination of both the start and end of the sampled values are replaced with a “%” character. In some instances, determining whether to replace the starting characters, the ending characters, and/or the both the starting and ending characters with a “%” character can be determined randomly and the number of characters to replace can be random.

In some instances, at lexicalization stage 4220, each parsed template of the parsed templates 4206 can be lexicalized with the sampled components 4214 for the respective parsed template to produce lexicalized training examples 4222 (i.e., the synthetic training examples). In some instances, a parsed utterance and its corresponding parsed SQL query in parsed templates 4206 can be lexicalized by replacing the non-terminal symbols of the utterance and its corresponding SQL query with the components 4214 of the selected database 4216 sampled for the respective parsed utterance and SQL query.

In some instances, at validation stage 4224, each lexicalized training example of lexicalized training examples 4222 can be validated and lexicalized training examples that are valid can be included in the lexicalized training data 4114 (i.e., the synthetic training data) and lexicalized training examples that are not valid can be discarded (i.e., the discarded training examples 4226). In some instances, in order to validate each lexicalized training example, a constraint check can be performed on each lexicalized training example. In some instances, the constraint check is performed by executing the respective lexicalized SQL query against a database in the one or more databases 4216. In some instances, the database can be randomly selected from the one or more databases 4216. In some instances, the database can be database 4216. In some instances, if execution of the lexicalized SQL query against a database returns an empty result, the lexicalized SQL query can be discarded. In some instances, if execution of the lexicalized SQL query returns a non-empty result, the WHERE clauses in the SQL query are treated as true and the lexicalized SQL query is again executed against the database. In some instances, if execution of the lexicalized SQL query with its WHERE clauses treated as true returns a non-empty result, the lexicalized SQL query can be included in the lexicalized training data 4114; otherwise, the lexicalized SQL query can be discarded.

In some instances, the constraint check is performed by determining whether the sampled columns of the sampled components 4214 used to lexicalize the respective lexicalized utterance and its corresponding SQL query are consistent with the type of the COLUMN non-terminal symbol in the delexicalized utterance and delexicalized SQL query prior to lexicalization. For example, a sampled component COLUMN.TEXT should be sampled for a COLUMN.NUMBER non-terminal symbol in the delexicalized utterance and its corresponding delexicalized SQL query. In some instances, the constraint check is performed by determining whether the sampled columns of the sampled components 4214 satisfy one or more conditions based on their respective type and constraints. For example, a column with a COLUMN.NUMBER type with an Aggregatable constraint should be located in the lexicalized SQL query inside a MAX, MIN, AVG, and COUNT SQL operation. In some instances, an exemplary column types, constraints, and conditions are listed in the table below:

TypeConstraint Eligible Types Condition Aggregateable Number Column is inside a MAX, MIN, AVG, Time COUNT operation Currency Age Measure Requestable All Column is requested inside SELECT clause Sortable Same as Column is used inside these operators aggregateable (<, >, <=, >=, BETWEEN) Comparable All except ID Column is used inside equal and not equal operators Orderable All Column is used in order by clause Groupable All Column is used in group by clause Filterable All Column is used in WHERE clause

In some instances, a data structure can be generated and the lexicalized training data 4114 can be organized and stored in the data structure. In some instances, each lexicalized utterance and its corresponding lexicalized SQL in the lexicalized training data 4114 can be organized in a predetermined format. In some instances, an exemplary predetermined format is as follows:

{  “nl_lexicalized”: “Show all player attributes shot power with at least 3 player attributes” . ,  “sql_lexicalized”: “SELECT Player_Attributes.shot_power FROM Player_Attributes GROUP BY Player_Attributes.shot_power HAVING Count(*) >= 3.0”,  “template”: {   “nl”: “Show all TABLE#0.COLUMN#0 with at least 3 TABLE#0 .”,   “sql”: “SELECT TABLE#0.COLUMN#0 FROM TABLE#0 GROUP  BY TABLE#0.COLUMN#0 HAVING Count ( * ) >= 3”  },  “mapping”: {   “nl_map”: {    “TABLE#0.COLUMN#0”: “player attributes shot power”,    “TABLE#0”: “player attributes”   },   “sql_map”: {    “TABLE#0”: “Player_Attributes”,    “TABLE#0.COLUMN#0”: “shot_power”   }  },  “col_type_constraint”: {   “TABLE#0.COLUMN#0”: [    “SqlTypeConstraint.REQUESTABLE”,    “SqlTypeConstraint.GROUPABLE”   ]  },  “col_type_assignment”: {   “TABLE#0.COLUMN#0”: “SqlColumnTypes.NUMBER”  },  “value_bound”: { },  “column_bound”: { },  }

Returning to the discussion of FIG. 4A, upon generating the lexicalized training data 4114 at lexicalization stage 4112, the lexicalized training data 4114 can be optionally paraphrased at paraphrasing step 4116 to produce paraphrased lexicalized training data 4118. In some instances, the lexicalized training data 4114 can be clunky. For example, in some instances, some delexicalized utterances in the templates 4110 can include nonterminal symbols corresponding to multiple different columns from the same table, which results in a delexicalized utterance with the table name included in multiple instances. In some instances, clunkiness can be reduced by defining a rule to reduce the number of table name mentions in the lexicalized utterance. For example, a rule may be defined at paraphrasing step 4116 to only allow one mention of table name at the first instance of a COLUMN non-terminal symbol in the utterance from the start of the utterance to the end of the utterance and for any COLUMN non-terminal symbols that appear in the utterance after the first instance, it is assumed that that COLUMN is from the same table as the first instance and an “s” can be added to the COLUMN non-terminal symbol (e.g., COLUMN's). Additionally, if that particular table appears in the NL examples as a single table mentioned, thus the delexicalized columns that come from that table do not need to mention the table name at all. In some instances, clunkiness can be reduced by sending the lexicalized training data 4114 to a crowd worker for paraphrasing.

In some instances, the lexicalized training data 4114 and/or the paraphrased lexicalized training data 4118 can be combined with the training data 4102 to produce updated training data 4120. In some instances, the updated training data 4120 can be used to train one or more natural language to logical form (NL-LF) algorithms such as the NL-LF algorithm(s) 4918 described below with respect to FIG. 4F.

Using the foregoing data manufacturing framework based on templates and a SCFG, additional training data can be generated without the time, effort, and money required to gather and clean data under the conventional approaches. Additionally, using the foregoing data manufacturing framework based on templates and a SCFG, models that perform well on select databases and that can generalize well to new and unseen databases can be built.

Framework Based on a Probabilistic Context-Free Grammar and Translator

Synthetic training data that includes NL utterances and corresponding SQL queries can be generated under a data manufacturing framework based on a probabilistic context-free grammar (PCFG) and a translator. The data manufacturing framework can generate synthetic training data by accessing training data that includes NL utterances and corresponding SQL queries, finetuning a translator with the training data, delexicalizing the SQL queries in the training data, generating additional SQL queries using a PCFG, generating lexicalized SQL queries by lexicalizing the delexicalized SQL queries and the additional SQL queries, generating NL utterances from the lexicalized SQL queries using the translator, forming generated training data (i.e., the synthetic training data) with the generated NL utterances and the lexicalized SQL queries. The original training data can be combined with the synthetic training data to form updated training data. In some instances, prior to combining the training data and the synthetic training data, the generated training data can be paraphrased to form paraphrased generated training data which can be combined with the original training data to form the updated training data.

FIG. 4C is a simplified logical flow diagram 4300 of an example process for generating training data under a data manufacturing framework based on a PCFG and a translator. The flow starts with accessing the training data 4102 (i.e., the original training data). The training data 4102 has been described above.

Upon accessing the training data 4102, a pre-trained model can be finetuned to form an NL translator 43042 with the training data 4102 at translator finetuning stage 4304. In some instances, the NL translator 43042 can translate SQL queries into utterances. For example, the SQL query “SELECT Count(*) FROM singer” can be translated into the utterance “How many singers are there?” In some instances, the pre-trained model is configured to perform a translation task (e.g., a text-to-text translation task, a string-to-string translation task, and the like). In some instances, the pre-trained model is trained with a set of training utterances, including a set of source utterances and a set of target utterances. An example of a pretrained model that is configured to perform a translation task is the Text-To-Text Transfer Transformer (T5). Additional information for the T5 translator is found in “Exploring the limits of transfer learning with a unified text-to-text transformer” by Raffel et al., published in The Journal of Machine Learning Research, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

In some instances, pre-trained model can be finetuned to form NL translator 43042 using transfer learning. In some instances, the weights and parameters of the pre-trained model can be adjusted based on the training data 4102 using machine learning optimization techniques (e.g., AdamW). In some instances, the logical forms in the training data 4102 can be set as a source language and the utterances in the training data 4102 can be set as a target language. In some instances, using the pre-trained model, a loss/error can be computed between predictions of the utterances by the pre-trained model and utterances in the training data 4102, the loss/error can be used to compute gradients, and the gradients can be used to update the model weights and biases of the pre-trained model. In this way, the pre-trained model, which is pre-trained to perform a translation task, can be finetuned to form NL translator 43042 configured to translate SQL queries to natural language utterances.

At SQL delexicalization and generation stage 4306, a delexicalized SQL query set 4308 can be generated by delexicalizing the SQL queries in the training data 4102 and generating additional delexicalized SQL queries from the delexicalized SQL queries. Delexicalizing SQL queries has been described above and is not repeated here. In some instances, additional delexicalized SQL queries can be generated from delexicalized SQL queries by parsing the delexicalized SQL queries into ASTs (described above) and using a PCFG to generate the additional delexicalized SQL queries from the ASTs. A PCFG to refers to a context-free grammar in which the sum of all probabilities of the production rules for the same non-terminal symbols is equal to one. A PCFG includes terminal symbols (e.g. x¹, x¹, . . . x^(v)) nonterminal symbols (e.g., N¹, N², . . . N^(n)), a start symbol (e.g., N¹), a set of rules (e.g, N^(i)→β^(j), where β^(j) is a sequence of terminals and non-terminals), and rule probabilities (e.g., ∀_(i) ∈_(j) P(N^(i)→β^(j))=1). Given a PCFG, the probability of a SQL query (e.g., including tokens w₁, w₂, . . . w_(m)) is P(w_(1n))=∈_(t) P(w_(1n), t), where t is the parse tree (AST) of w_(1n). Additional information for generating SQL queries using a PCFG can be found in “Learning to Synthesize Data for Semantic Parsing” by Wang et al., published in arXiv preprint arXiv:2104.05827, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

At SQL lexicalization stage 4310, the delexicalized SQL query set 4308 can be lexicalized to form a lexicalized SQL set 4312. Lexicalization of SQL queries is described above and is not repeated here.

At translation stage 4314, using the NL translator 43042, the lexicalized SQL query set 4312 can be translated into NL utterances to form a NL utterance set and the NL utterance set can be combined with the lexicalized SQL query set 4312 to form generated training data 4316 (i.e., the synthetic training data). In some instances, each NL utterance of the NL utterance set can form a pair with the respective lexicalized SQL query of the lexicalized SQL set 4312 used as input to predict the respective NL utterance. In this way, the generated training data 4316 can include NL utterances and corresponding SQL queries that are not in the training data 4102.

Upon generating the generated training data 4316 at translation stage 4314, the generated training data 4316 can be optionally paraphrased at paraphrasing step 4318 to produce paraphrased generated training data 4320. Paraphrasing is described above and not repeated here.

In some instances, the generated training data 4316 and/or the paraphrased generated training data 4320 can be combined with the training data 4102 to produce updated training data 4322. In some instances, the updated training data 4322 can be used to train one or more natural language to logical form (NL-LF) algorithms such as the NL-LF algorithm(s) 4918 described below with respect to FIG. 4F.

Using the foregoing data manufacturing framework based on a PCFG and a translator, additional training data can be generated without the time, effort, and money required to gather and clean data under the conventional approaches. Additionally, using the foregoing data manufacturing framework based on a PCFG and a translator, models that perform well on select databases and that can generalize well to new and unseen databases can be built.

Framework Based on Tree-to-String Translation

Synthetic training data that includes NL utterances and corresponding SQL queries can be generated under a data manufacturing framework based on tree-to-string translation. The data manufacturing framework can generate synthetic training data by accessing training data that includes NL utterances and corresponding SQL queries, parsing and normalizing the SQL queries in the training data into ASTs, delexicalizing the SQL queries in the training data, generating lexicalized SQL queries by lexicalizing the delexicalized SQL queries, generating NL utterances from the ASTs and lexicalized SQL queries using tree-to-string translation, and forming generated training data (i.e., the synthetic training data) with the generated NL utterances and the lexicalized SQL queries. The original training data can be combined with the synthetic training data to form updated training data. In some instances, prior to combining the training data and the synthetic training data, the generated training data can be paraphrased to form paraphrased generated training data which can be combined with the training data to form the updated training data.

FIG. 4D is a simplified logical flow diagram 4400 of an example process for generating training data under a data manufacturing framework based on tree-to-string translation. The flow starts with accessing the training data 4102 (i.e., the original training data). The training data 4102 has been described above.

Upon accessing the training data 4102, the SQL queries in the training data 4102 can be parsed into ASTs (described above) and the ASTs can be normalized at SQL parsing and normalizing stage 4404. In some instances, in order to normalize the ASTs, an AST of the ASTs including a node having more than two children can be binarized such that each node of the respective AST has no more than two children. For example, as shown in FIG. 4E, an AST 4500 including a node 4510 having more than two children can be binarized such that each node 4510 having more than two children can become one or more nodes 4520 having no more than two children. In some instances, in order to normalize the ASTs, a unary wrapping can be performed on each AST such that a unary head identifier is applied at each node of the respective AST that corresponds to a non-terminal. For example, as shown in FIG. 4E, in a unary wrapping process 4600, unary head identifiers 4610 can be applied to each node of AST 4620 because each node corresponds to non-terminal. In some instances, SQL queries that include one or more predefined clauses associated with one or more conditions may not parse correctly (e.g., the SQL AST does not include a child node for the one or more conditions when it should). Examples of such predefined clauses include a WHERE clause, a GROUP clause, an ORDERBY clause, an IEU (intersect, except, union) clause, and the like. For example, the SQL query “SELECT Column FROM Table WHERE one or more conditions” may parse to an AST in which a child node is not generated for each of the one or more conditions. In these cases, in order to normalize the AST, the AST will be normalized to include one or more deletion nodes for each of the predefined clauses not present in the SQL query such that the AST will have the requested child node and possible combinations thereof. For example, as shown in FIG. 4E, in a deletion node addition process 4700, the SQL query 4710, which includes the WHERE clause and a condition (i.e., the non-terminal token “50”) is represented by the AST 4720 in which deletion nodes 4730 are added with an identifier (e.g., _DELETE_) for the other predefined clauses (e.g., GROUPBY, ORDERBY, IEU, etc.).

At SQL delexicalization stage 4408, a delexicalized SQL query set 4410 can be generated by delexicalizing the SQL queries in the training data 4102. Delexicalizing SQL queries has been described above and is not repeated here.

At SQL lexicalization stage 4412, the delexicalized SQL query set 4410 can be lexicalized to form a lexicalized SQL set 4414. Lexicalization of SQL queries is described above and is not repeated here.

At translation stage 4416, NL utterances can be generated for the lexicalized SQL queries in the lexicalized SQL query set 4414. In some instances, an NL utterance can be generated for each lexicalized SQL query in the lexicalized SQL query set 4414. In some instances, the NL utterances can be generated using a tree-to-string (TTS) model 44162. In some instances, the TTS model 44162 generates the NL utterances based on lexicalized SQL query set 4414, the SQL ASTs 4406, and SQL Grammar 4418. In some instances, the NL utterances can be combined with the lexicalized SQL queries in the lexicalized SQL query set 4414 to form generated training data 4420 (i.e., the synthetic training data). In some instances, each generated NL utterance can form a pair with the respective lexicalized SQL query of the lexicalized SQL set 4414 that was used by the TTS model 44162 to generate the respective NL utterance. In this way, the generated training data 4420 can include NL utterances and corresponding SQL queries that are not in the training data 4102.

In some instances, the TTS model 44162 generates an NL utterance for each lexicalized SQL query of lexicalized SQL set 4416 based on a SQL Grammar 4418. In some instances, SQL Grammar 4418 can include rules for tree transduction that define rules of source subtree transformations while also defining rules for synchronously generating output strings. In some instances, the SQL Grammar 4418 can include a plurality of SCFG rules, a plurality of tree transduction rules, and a plurality of utterances that correspond to the plurality of SCFG rules and the plurality of tree transduction rules. For example, as shown in FIG. 4E, the SQL Grammar 4418 can include a plurality of SCFG rules 4800, a plurality of tree transduction rules 4820, and a plurality of utterances 4840 that correspond to the plurality of SCFG rules 4800 and the plurality of tree transduction rules 4820. In some instances, the plurality of SCFG rules 4800 define the grammatical structure of the SQL queries in the lexicalized SQL query set 4416. In some instances, each tree transduction rule 4830 of the plurality of tree transduction rules 4820 is a binarized version of a respective SCFG rule 4810 of the plurality SCFG rules 4800 and defines how a source tree (e.g., an AST) can be transformed into a target tree (e.g., an utterance tree). In some instances, each utterance 4850 of the plurality of utterances 4840 corresponds to a respective SCFG rule 4810 of the plurality of SCFG rules 4800 and a respective tree transduction rule 4830 of the plurality of tree transduction rules 4820. In some instances, as shown in FIG. 4E, the plurality of SCFG rules 4800 is grouped by their head (i.e., the symbol on the left of the arrow) where each SCFG rule 4810 has a matching source and target. In some instances, a rule may include a non-terminal. In some instances, the non-terminal can be a variable that is be rewritten for the utterance 4850 based on a respective tree transduction rule of the plurality of learned tree transduction rules 4820. In some instances, the plurality of SCFG rule 4800 can be learned from the training data 4102 (described above). In other instances, the plurality of SCFG rules 4800 can be the Abstract Syntax Description Language (ASDL) for the Spider database (described above). Additional information for the Spider ASDL is found in “LGESQL: Line Graph Enhanced Text-To-Sql Model with Mixed Local and Non-local Relations” by Ruisheng et al., published in arXiv preprint arXiv:2106.01093, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

In some instances, the TTS model 44162 generates an NL utterance for each lexicalized SQL query of lexicalized SQL set 4416 by (a) reordering nodes of the AST for the respective lexicalized SQL query based on the plurality of SCFG rules 4800 and the plurality of tree transduction rules 4820 into a reordered AST for the respective lexicalized SQL query and (b) decoding the reordered AST into an NL utterance for the respective lexicalized SQL query based on the respective lexicalized SQL query. In some instances, in order to reorder the nodes of an AST, each SCFG rule of the plurality of SCFG rules can be applied to each child node of the respective AST to identify which nodes correspond to the non-terminals of plurality of SCFG rules and each tree transduction rule of the plurality of tree transduction rules can be applied to each identified node to reorder the nodes to match the structure defined by the plurality of tree transduction rules. For example, an AST for a SQL query can be arranged with a SELECT node representing a SELECT operator in the SQL query in a first layer of the AST, a COLS node representing column(s) in the SQL query in a leftmost branch of a second layer of the AST, a FROM node representing a FROM operator in the SQL query in a middle branch of the second layer of the AST, and a WHERE node representing a WHERE operator in the SQL query in a rightmost branch of the second layer of the AST. The AST can further include a third layer for each node in the second layer and each node in the third layer can represent one or more targets of the nodes of the second layer. For example, the COLS node can include a child node in the third layer that represents the column referenced in the SQL query, the FROM node can include a child node in the third layer that represents the table referenced in the SQL query, and the WHERE node can include a child node in the third layer that represents a value in the column referenced in the SQL query.

The AST can be reordered based on SCFG rules and tree transduction rules. In order words, a new AST can be generated in which one or more child nodes of an existing branch can be moved to another branch and/or new branch and/or an order of the branches can be rearranged (e.g., a leftmost branch becomes a rightmost branch). In some instances, the AST can be reordered by finding all the transduction rules that can apply to an existing tree. An SCFG rule and corresponding tree transduction rule applies when the head of the SCFG rule matches a node in the AST and the state of the node matches the state of the SCFG rule. In some instances, when a portion of the AST matches an SCFG rule, the corresponding tree transduction rule is applied, and a new AST subtree is generated and added to the AST by replacing the branch (or subtree) that matched the SCFG rule with the right-hand side of the SCFG rule as structured by the tree transduction rule. A complete tree transduction begins with the root node being in the initial state (e.g., the SELECT node) then continues with states beneath the root node by propagating down the tree to the leaves until the entire tree has been transduced.

In some instances, the TTS model 44162 can reorder the AST prior to decoding the reordered AST. In other instances, the AST can be reordered and decoded concurrently. In some instances, the TTS model 44612 can be trained with a dataset that includes SQL queries, translated NL utterances for those SQL queries, a tree transduction rule set, and an index that associates one or more tree transduction rules of the tree transduction rule set with each SQL query and its corresponding translated NL utterance. Advantageously, the TTS model 44612 can store the SQL Grammar efficiently, match input ASTs efficiently, and produce NL utterances efficiently, produce a list of traces of tree transduction rules, and produce a list of possible NL utterances in forms of an n-best list and/or an exhaustive list. In some instances, the TTS model 44162 can be the Travatar Translation Engine. Additional information for the Travatar tree transducer is found in “Travatar: A Forest-to-String Machine Translation Engine based on Tree Transducers” by Neubig, published In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics: System Demonstrations, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

Upon generating the generated training data 4420 at translation stage 4414, the generated training data 4420 can be optionally paraphrased at paraphrasing step 4422 to produce paraphrased generated training data 4424. Paraphrasing is described above and not repeated here.

In some instances, the generated training data 4420 and/or the paraphrased generated training data 4424 can be combined with the training data 4102 to produce updated training data 4426. In some instances, the updated training data 4426 can be used to train one or more natural language to logical form (NL-LF) algorithms such as the NL-LF algorithm(s) 4918 described below with respect to FIG. 4F.

Using the foregoing data manufacturing framework based on tree-to-string translation, additional training data can be generated without the time, effort, and money required to gather and clean data under the conventional approaches. Additionally, using the foregoing data manufacturing framework based on tree-to-string translation, models that perform well on select databases and that can generalize well to new and unseen databases can be built.

Model System

FIG. 4F shows a block diagram illustrating aspects of a model system 4900 configured to train and deploy machine learning models 4924 (e.g., a natural language to logical form translator models that may be used by a digital assistant or chatbot as described with respect to FIGS. 1-3 ). The model system 4900 in this example includes various stages: a training stage 4910 to train the machine learning models for translating natural language to a logical form such as SQL, a logical form inference stage 4920 to translate natural language utterances into logical form queries, and a query stage 4930 to execute logical form queries on a system such as a relational database system.

To train the various machine learning models 4924, the training stage 4910 is comprised of two main subsystems or services: dataset preparer 4914 and model trainer 4916. The dataset preparer 4914 facilitates the process of loading data assets 4912, splitting the data assets 4912 into training and validation sets so that the system can train and test the machine learning models 4924, and performing basic natural language pre-processing (e.g., standardization, normalization, tokenizing data, annotation, augmentation, embedding, etc.). The data assets 4912 include natural language utterances (e.g., natural language questions/requests) and their corresponding logical forms (e.g., statements/queries such as SQL queries). In some instances, the data assets 4912 can be accessed from one or more sources such as a database (not shown), a computing system (e.g., data preprocessing subsystem), or the like. In some instances, the data assets 4912 are provided by a client or customer. In some instances, the data assets 4912 can be obtained using any of the data manufacturing frameworks described above with respect to FIGS. 4A-4E.

Once the data assets 4912 are obtained, the datasets may be split into training and validation datasets. The splitting may be performed randomly (e.g., a 90/10% or 70/30%) or the splitting may be performed in accordance with a more complex validation technique such as K-Fold Cross-Validation, Leave-one-out Cross-Validation, Leave-one-group-out Cross-Validation, Nested Cross-Validation, or the like to minimize sampling bias and overfitting. Before or after splitting, basic natural language pre-processing may be performed on the data assets 4912. In some instances, the pre-processing includes tokenizing the utterances. Tokenizing is splitting a phrase, sentence, paragraph, or an entire text document into smaller units, such as individual words or terms. Each of these smaller units are called tokens. Smaller units are created by locating boundaries such as word boundaries, which are the ending point of a word and the beginning of the next word. For example, the text “How many employees work for company X” can be word tokenized into ‘How’, ‘many’, ‘employees’, ‘work’, ‘for’, ‘company’, ‘X’. These tokens help the model to understand the context and develop the model for a given task. There are various tokenization techniques which can be used for executing the tokenizing based on the language and modeling task. For example, the tokenizing may be performed using Natural Language ToolKit, white space tokenization, dictionary-based tokenization, rule-based tokenization, Keras tokenization, Penn Tree based tokenization, spaCy tokenization, Moses tokenization, subword tokenization, or the like.

In some instances, the tokens for data assets 4912 may then be embedded to word embeddings. A word embedding is a learned representation for text where words that have the same meaning have a similar representation. Word embeddings are generated by embedding techniques where individual words are represented as real-valued vectors in a predefined vector space so they can be understood by deep learning algorithms. The embedding techniques can be joint or individual embedding techniques such as including an embedding layer within the deep learning algorithm or using a separate model such as Word2Vec or GloVe. An embedding layer is a word embedding that is learned jointly with a neural network model on a specific natural language processing task, such as the natural language to logical form translation (e.g., the NL-LF algorithm(s) 4918). Word2Vec is a statistical technique that uses a model such as Continuous Bag-of-Words or Continuous Skip-Gram Model for learning a standalone word embedding from a text corpus. GloVe, for Global Vectors, is a model for creating word embeddings based on the global corpus statistics. It is trained on the non-zero entries of a global word-word co-occurrence matrix, which tabulates how frequently words co-occur with one another in a given corpus.

The natural language-logical form (NL-LF) algorithm(s) 4918 are trained by model trainer 4916 using the preprocessed data assets 4912 (e.g., tokenized data assets). In some instances, the NL-LF algorithm(s) 4918 comprise an encoder-decoder neural network. The encoder is comprised of an input layer and one or more encoding layers. The one or more encoding layers may include multiple recurrent units such as Long Short-Term Memory (LSTM), where each recurrent unit gets input in the form of a single element of the input sequence, gathering data for that specific element and generating it forward. The encoder follows an embedding procedure to transform the relevant text (and optionally the database schema) into number/vector representation to conserve the conditions and connection between words and sentences, such that a machine can comprehend the pattern associated with any text, make out the context of the sentences, and optionally learn relationships between words and a given database schema. The result of the encoder will be a state vector or context vector. This state vector will be the input for the decoder. The decoder is comprised of an input layer, one or more decoding layers, a dense layer, and an output layer (e.g., a layer with a softmax function). The one or more decoding layers may include multiple recurrent units such as LSTM in which an output for every time step is predicted. The current recurrent unit accepts a hidden state from the earlier recurrent unit. The result of the decoder will be a logical form such as SQL query translated from an utterance within the preprocessed data assets 4912. Examples of a trained model 4924 such as a NL-LF model include, but are not limited to, RAT-SQL and DuoRAT. Additional information for the RAT-SQL model is found in “RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers” by Wang et al., published in Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, the entire contents of which are hereby incorporated by reference as if fully set forth herein. Additional information for the DuoRAT model is found in “DuoRAT: Towards Simpler Text-to-SQL Models” by Scholak et al., published in Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics, the entire contents of which are hereby incorporated by reference as if fully set forth herein.

The model training includes selecting hyperparameters for the model 4924 and using an optimization algorithm (e.g., a stochastic gradient descent algorithm or a variant thereof such as batch gradient descent or minibatch gradient descent) to find the model parameters that correspond to the best fit between predicted and actual outputs. The hyperparameters are settings that can be tuned or optimized to control the behavior of the model 4924. Most models explicitly define hyperparameters that control different aspects of the models such as memory or cost of execution. However, additional hyperparameters may be defined and optimized to adapt a model to a specific scenario. For example, the hyperparameters may include the number of hidden units of a model, the learning rate of a model, the convolution kernel width, or the number of kernels for a model.

During training, error is calculated as the difference between the actual output and the predicted output. The function that is used to compute this error is known as an objective function (e.g., a loss function or a cost function). Error is a function of internal parameters of the model, e.g., weights and bias. For accurate predictions, the error needs to be minimized. In order to minimize the error, the model parameters are incrementally updated by minimizing the objective function over the training examples from preprocessed data assets 4912. The objective function can be constructed to measure the difference between the outputs inferred using the models and the ground truth annotated to the samples using the labels. For example, for a supervised learning-based model, the goal of the training is to learn a function “h( )” (also sometimes referred to as the hypothesis function) that maps the training input space X to the target value space Y, h: X→Y, such that h(x) is a good predictor for the corresponding value of y. Various different techniques may be used to learn this hypothesis function. In some machine learning algorithms such as a neural network, this is done using back propagation. The current error is typically propagated backwards to a previous layer, where it is used to modify the weights and bias in such a way that the error is minimized. The weights are modified using the optimization function. Optimization functions usually calculate the error gradient, i.e., the partial derivative of the objective function with respect to weights, and the weights are modified in the opposite direction of the calculated error gradient. For example, techniques such as back propagation, random feedback, Direct Feedback Alignment (DFA), Indirect Feedback Alignment (IFA), Hebbian learning, and the like are used update the model parameters in such a manner as to minimize or maximize this objective function. This cycle is repeated until the minima of the objective function is reached.

Once a set of model parameters are identified by the model trainer 4916, the model 4924 has been trained and a validator is configured to validate the model 4924 using the validation datasets. The validation process performed by the validator includes iterative operations of inputting the validating datasets into the model 4924 using a validation technique such as K-Fold Cross-Validation, Leave-one-out Cross-Validation, Leave-one-group-out Cross-Validation, Nested Cross-Validation, or the like to tune the hyperparameters and ultimately find the optimal set of hyperparameters. Once the optimal set of hyperparameters are obtained, a reserved test set of data from the validating datasets are input into the model 4924 to obtain output, and the output is evaluated versus ground truth values using correlation techniques such as Bland-Altman method and the Spearman's rank correlation coefficients and calculating performance metrics such as the error, accuracy, precision, recall, receiver operating characteristic curve (ROC), etc. In some instances, the obtaining, training, and validating data processes in the model system 4900 can be repeatedly performed (adjusted) by the model trainer 4916 until a predetermined condition is satisfied and a set of model parameters can be provided by the model trainer 4916.

As should be understood, other training/validation mechanisms are contemplated and may be implemented within the model system 4900. For example, the model 4924 may be trained and hyperparameters may be tuned on datasets from the subset of obtained or filtered datasets and the datasets from the subset of obtained or filtered datasets may only be used for testing and evaluating performance of the model 4924. Moreover, although the training mechanisms described herein focus on training a new model 4924. These training mechanisms can also be utilized to fine tune existing models trained from other datasets. For example, in some instances, a model 4924 might have been pre-trained using datasets from different modalities or tasks. In those cases, the models 4924 can be used for transfer learning and retrained/validated using the training and validating data.

The training stage 4910 outputs a trained model 4924 with an optimized set of model parameters and hyperparameters for use in the inference stage 4920. The inference stage 4920 comprises a predictor 4928 for translating natural language to a logical form. For example, the predictor 4928 executes processes for inputting natural language utterance(s) 4922 such as a non-follow-up utterance, one or more follow-up utterances, or a combination thereof into the trained model 4924, and generating, using the trained model 4924, a prediction for a logical form 4926 based on features within the natural language utterance(s) 4922. The inference stage 4920 outputs a prediction for the logical form 4926 for optional use in query stage 4930. The query stage 4930 comprises one or more executors 4932 configured for executing the logical form 4926 on a system such as database 4934 to obtain a result 4936 (e.g., an answer to a query within utterances(s) 4922). For example, the one or more executors 4932 may be configured to execute a SQL query on a relational database to obtain an answer to a query posed in the natural language utterance(s) 4922.

While not explicitly shown, it will be appreciated that the model system 4900 may further include a developer device associated with a developer. Communications from a developer device to components of the model system 4900 may indicate what types of input data, utterances, and/or database schema are to be used for the models, a number and type of models to be used, hyperparameters of each model, for example, learning rate and number of hidden layers, how data requests are to be formatted, which training data is to be used (e.g., and how to gain access to the training data) and which validation technique is to be used, and/or how the controller processes are to be configured.

Illustrative Methods

FIG. 5A illustrates an example process 5100 for synthesizing synthetic training data based on templates and a SCFG. The processing depicted in FIG. 5A may be implemented in software (e.g., code, instructions, a program) executed by one or more processing units (e.g., one or more processors, cores) of the respective systems, hardware, or combinations thereof described throughout. The software may be stored on a non-transitory storage medium (e.g., on a memory device). Although the methods presented in FIG. 5A depict the various processing steps occurring in a particular sequence or order, this is not intended to be limiting. In certain alternative embodiments, the steps may be performed in parallel and/or in a different order. In certain embodiments, such as in the embodiment depicted in FIGS. 1-4F, the processing depicted in FIG. 5A may be performed by a pre-processing subsystem (e.g., pre-processing subsystem 210) and/or the model system 4900.

At block 5102, original training data is accessed. In some instances, the original training includes a plurality of utterances and a plurality of logical forms (e.g., SQL queries) with each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances. In some instances, the original training data includes database schema information for one or more databases.

At block 5104, a plurality of templates is generated. In some instances, each template of the plurality of templates includes a delexicalized version of an utterance in the plurality of utterances and a delexicalized version of a logical form corresponding to the utterance. In some instances, the plurality of templates can be generated automatically from the utterances and their corresponding logical forms in the original training data using a trained machine learning model. In some instances, the machine learning model is trained to perform approximate string matching. In some instances, the trained machine learning model can predict which words in a respective utterance correspond to table names, table column names, and column values in the database schema information and replace those words with the non-terminal symbols. In some instances, the plurality of template can be generated by a user based on a rules scheme.

At block 5106, a grammar is learned from the plurality of logical forms. In some instances, the grammar defines a plurality of production rules for lexicalizing the plurality of templates. In some instances, the grammar is an SCFG. In some instances, the grammar can be learned based on the utterances and database schema information included in the original training data. In some instances, the grammar can be learned by setting table names, column names, and values in the database schema information as non-terminal symbols, setting logical form operators such as SQL operators (e.g., Max, Min, =, Like, etc.) as non-terminal symbols, setting logical form functions such as SQL functions (e.g., Ave., Count, First, Last, etc.) as non-terminal symbols, and generating one or more production rules. In some instances, the one or more production rules are generated by replacing one or more words, entities, or phrases in the utterances in the original training data with the set non-terminal symbols.

At block 5108, synthetic training data is generated. In some instances, the synthetic training data is generated by parsing each template of the plurality of templates, sampling a database to identify a plurality of sampling components, and a lexicalizing each template of the plurality of templates with at least one sampling component of the plurality of sampling components. In some instances, plurality of templates can be parsed using a parsing algorithm and the SCFG. In some instances, the parsing algorithm can apply the SCFG to each delexicalized utterance and its corresponding delexicalized logical form to generate an AST for each parsed delexicalized utterance and its corresponding parsed delexicalized logical form in which their respective logical syntactic components are identified and represented in the AST.

In some instances, in order to sample a database to identify a plurality of sampling components, each template in the plurality of templates is analyzed to identify one or more constraints in the respective template, a database is analyzed to identify its components, database components are sampled based on the identified one or more constraints in each template, and the non-terminal symbols in each delexicalized utterance and its corresponding delexicalized logical form are replaced with the sampled components. In some instances, components are sampled from the database based on a database analysis of the database and the analyzed templates. In some instances, the database is one or more relational databases with each database having components (e.g., tables, columns, and values). In some instances, a database analysis is performed on the one or more databases to identify its components. In some instances, components are sampled from the database based on the analysis of the non-terminal symbols in the analyzed templates. In some instances, each parsed template of the plurality of parsed templates can be lexicalized with the sampled components for the respective parsed template to produce lexicalized training examples (i.e., the synthetic training examples). In some instances, a parsed utterance and its corresponding parsed logical form in parsed templates can be lexicalized by replacing the non-terminal symbols of the utterance and its corresponding logical form with the components of the selected database sampled for the respective parsed utterance and logical form.

In some instances, each lexicalized training example of lexicalized training examples can be validated and lexicalized training examples that are valid can be included in the lexicalized training data (i.e., the synthetic training data) and lexicalized training examples that are not valid can be discarded (i.e., the discarded training examples). In some instances, in order to validate each lexicalized training example, a constraint check can be performed on each lexicalized training example. In some instances, the constraint check is performed by executing the respective lexicalized logical form against a database in the one or more databases.

Upon generating the lexicalized training data (i.e., the synthetic training data), the lexicalized training data can be paraphrased to produce paraphrased lexicalized training data. In some instances, the lexicalized training data and/or the paraphrased lexicalized training data can be combined with the original training data to produce updated training data.

FIG. 5B illustrates an example process 5200 for synthesizing synthetic training data based on a probabilistic context-free grammar and a statistical translator. The processing depicted in FIG. 5B may be implemented in software (e.g., code, instructions, a program) executed by one or more processing units (e.g., one or more processors, cores) of the respective systems, hardware, or combinations thereof described throughout. The software may be stored on a non-transitory storage medium (e.g., on a memory device). Although the methods presented in FIG. 5B depict the various processing steps occurring in a particular sequence or order, this is not intended to be limiting. In certain alternative embodiments, the steps may be performed in parallel and/or in a different order. In certain embodiments, such as in the embodiment depicted in FIGS. 1-4F, the processing depicted in FIG. 5B may be performed by a pre-processing subsystem (e.g., pre-processing subsystem 210) and/or the model system 4900.

At block 5202, original training data is accessed. In some instances, the original training data includes a plurality of utterances and a plurality of logical forms (e.g., SQL queries) with each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances. In some instances, the original training data includes database schema information for one or more databases.

At block 5204, a pre-trained model is obtained. In some instances, the pre-trained model is trained to translate utterances to logical forms. In some instances, the pre-trained model is a text-to-text transfer transformer.

At block 5206, the pre-trained model is finetuned. In some instances, the pre-trained model is finetuned to translate logical forms to utterances. In some instances, the finetuning is performed using the original training data and generates a finetuned model. In some instances, the pre-trained model can be finetuned using transfer learning. In some instances, weights and parameters of the pre-trained model can be adjusted based on the original training data using one or more machine learning optimization techniques (e.g., AdamW). In some instances, using the pre-trained model, a loss/error is computed, the loss/error is used to compute gradients, and the gradients are used to update the model weights and biases of the pre-trained model.

At block 5208, a set of delexicalized logical forms is generated. In some instances, the set of delexicalized logical forms includes delexicalized versions of the plurality of logical forms. In some instances, the delexicalized versions of the plurality of logical forms can be generated automatically from the utterances and their corresponding logical forms queries in the original training data using a trained machine learning model. In some instances, the machine learning model is trained to perform approximate string matching. In some instances, the trained machine learning model can predict which words in a respective utterance correspond to table names, table column names, and column values in the database schema information and replace those words with the non-terminal symbols. In some instances, the delexicalized versions of the plurality of logical forms can be generated by a user based on a rules scheme. In some instances, the set of delexicalized logical forms includes delexicalized logical forms generated using a PCFG. In some instances, the delexicalized logical forms generated using the PCFG can be generated by the delexicalized versions of the plurality of logical forms into ASTs and using the PCFG to generate the additional delexicalized logical forms from the ASTs.

At block 5210, a set of lexicalized logical forms is generated. In some instances, the set of lexicalized logical forms is generated by lexicalizing the set of delexicalized logical forms. In some instances, lexicalizing the set of delexicalized logical forms includes parsing each delexicalized logical form in the set of delexicalized logical forms, sampling a database to identify a plurality of sampling components, and a lexicalizing each parsed delexicalized logical with at least one sampling component of the plurality of sampling components. In some instances, the set of delexicalized logical forms can be parsed using a parsing algorithm and an SCFG. In some instances, the parsing algorithm can apply the SCFG to each delexicalized logical form to generate an AST for each parsed delexicalized logical form in which their respective logical syntactic components are identified and represented in the AST.

In some instances, in order to sample a database to identify a plurality of sampling components, each parsed delexicalized logical form is analyzed to identify one or more constraints in the respective parsed delexicalized logical form, a database is analyzed to identify its components, database components are sampled based on the identified one or more constraints in each parsed delexicalized logical form, and the non-terminal symbols in each parsed delexicalized logical form are replaced with the sampled components. In some instances, components are sampled from the database based on a database analysis of the database and the analyzed parsed delexicalized logical forms. In some instances, the database is one or more relational databases with each database having components (e.g., tables, columns, and values). In some instances, a database analysis is performed on the one or more databases to identify its components. In some instances, components are sampled from the database based on the analysis of the non-terminal symbols in the analyzed parsed delexicalized logical forms. In some instances, each parsed delexicalized logical form can be lexicalized with the sampled components for the respective parsed delexicalized logical form to produce a set of lexicalized logical forms. In some instances, a parsed delexicalized logical form can be lexicalized by replacing the non-terminal symbols of the parsed delexicalized logical form with the components of the selected database sampled for the respective parsed delexicalized logical form.

At block 5212, synthetic training data is generated. In some instances, the synthetic training data is generated by the finetuned model. In some instances, the synthetic training data includes an utterance for each lexicalized logical form of the set of lexicalized logical forms. In some instances, using the finetuned model, set of lexicalized logical forms can be translated into NL utterances to form a NL utterance set and the NL utterance set can be combined with the set of lexicalized logical forms to form generated training data (i.e., the synthetic training data). In some instances, each NL utterance of the NL utterance set can form a pair with the respective lexicalized logical form of the set of lexicalized logical forms used to translate the respective NL utterance. Upon generating the synthetic training data, the synthetic training data can be paraphrased to produce paraphrased synthetic training data. In some instances, the synthetic training data and/or the paraphrased synthetic training data can be combined with the original training data to produce updated training data.

FIG. 5C illustrates an example process 5300 for synthesizing synthetic training data based on tree-to-string translation. The processing depicted in FIG. 5C may be implemented in software (e.g., code, instructions, a program) executed by one or more processing units (e.g., one or more processors, cores) of the respective systems, hardware, or combinations thereof described throughout. The software may be stored on a non-transitory storage medium (e.g., on a memory device). Although the methods presented in FIG. 5C depict the various processing steps occurring in a particular sequence or order, this is not intended to be limiting. In certain alternative embodiments, the steps may be performed in parallel and/or in a different order. In certain embodiments, such as in the embodiment depicted in FIGS. 1-4F, the processing depicted in FIG. 5C may be performed by a pre-processing subsystem (e.g., pre-processing subsystem 210) and/or the model system 4900.

At block 5302, original training data is accessed. In some instances, the original training data includes a plurality of utterances and a plurality of logical forms with each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances. In some instances, the original training data includes database schema information for one or more databases.

At block 5304, a set of ASTs is generated for the plurality of logical forms. In some instances, the set of ASTs is generated by parsing each logical form of the plurality of logical forms into an AST and normalizing the respective AST. In some instances, in order to normalize the ASTs, an AST of the ASTs including a node having more than two children can be binarized into such that each node of the respective ASTs have no more than two children. In some instances, in order to normalize the ASTs, a unary wrapping can be performed on each AST such that a unary head identifier is applied at each node of the respective AST that corresponds to a non-terminal. In some instances, in order to normalize the ASTs, one or more deletion nodes will be added to a respective AST for each predefined clause of predefined clauses not present in the respective SQL query such that the AST will have the requested child node and possible combinations thereof. Examples of such predefined clauses include a WHERE clause, a GROUP clause, an ORDERBY clause, an IEU (intersect, except, union) clause, and the like.

At block 5306, a set of delexicalized logical forms is generated. In some instances, each delexicalized logical form of the plurality of delexicalized logical forms is a delexicalized version of a logical form of the plurality of logical forms. In some instances, the set of delexicalized logical forms includes delexicalized versions of the plurality of logical forms. In some instances, the delexicalized versions of the plurality of logical forms can be generated automatically from the utterances and their corresponding logical forms queries in the original training data using a trained machine learning model. In some instances, the machine learning model is trained to perform approximate string matching. In some instances, the trained machine learning model can predict which words in a respective utterance correspond to table names, table column names, and column values in the database schema information and replace those words with the non-terminal symbols.

At block 5308, a set of lexicalized logical forms is generated. In some instances, the set of lexicalized logical forms is generated by lexicalizing the set of delexicalized logical forms. In some instances, lexicalizing the set of delexicalized logical forms includes parsing each delexicalized logical form in the set of delexicalized logical forms, sampling a database to identify a plurality of sampling components, and a lexicalizing each parsed delexicalized logical with at least one sampling component of the plurality of sampling components. In some instances, the set of delexicalized logical forms can be parsed using a parsing algorithm and an SCFG. In some instances, the parsing algorithm can apply the SCFG to each delexicalized logical form to generate an AST for each parsed delexicalized logical form in which their respective logical syntactic components are identified and represented in the AST.

In some instances, in order to sample a database to identify a plurality of sampling components, each parsed delexicalized logical form is analyzed to identify one or more constraints in the respective parsed delexicalized logical form, a database is analyzed to identify its components, database components are sampled based on the identified one or more constraints in each parsed delexicalized logical form, and the non-terminal symbols in each parsed delexicalized logical form are replaced with the sampled components. In some instances, components are sampled from the database based on a database analysis of the database and the analyzed parsed delexicalized logical forms. In some instances, the database is one or more relational databases with each database having components (e.g., tables, columns, and values). In some instances, a database analysis is performed on the one or more databases to identify its components. In some instances, components are sampled from the database based on the analysis of the non-terminal symbols in the analyzed parsed delexicalized logical forms. In some instances, each parsed delexicalized logical form can be lexicalized with the sampled components for the respective parsed delexicalized logical form to produce a set of lexicalized logical forms. In some instances, a parsed delexicalized logical form can be lexicalized by replacing the non-terminal symbols of the parsed delexicalized logical form with the components of the selected database sampled for the respective parsed delexicalized logical form.

At block 5310, synthetic training data is generated. In some instances, the synthetic training data is generated using a TTS model. In some instances, the synthetic training data includes an utterance for each lexicalized logical form of the set of lexicalized logical forms. In some instances, the TTS model generates the NL utterances based on the set of lexicalized logical forms, the set of ASTs, and a SQL grammar. In some instances, SQL Grammar can include rules for tree transduction that define rules of source subtree transformations while also defining rules for synchronously generating output strings. In some instances, the SQL Grammar can include a plurality of SCFG rules, a plurality of tree transduction rules, and a plurality of utterances that correspond to the plurality of SCFG rules and the plurality of tree transduction rules. In some instances, the plurality of SCFG rules define the grammatical structure of the SQL queries in the lexicalized SQL query set. In some instances, each tree transduction rule of the plurality of tree transduction rules is a binarized version of a respective SCFG rule of the plurality SCFG rules and defines how a source tree (e.g., an AST) can be transformed into a target tree (e.g., an utterance tree). In some instances, each utterance of the plurality of utterances corresponds to a respective SCFG rule of the plurality of SCFG rules and a respective tree transduction rule of the plurality of tree transduction rules. In some instances, the plurality of SCFG rules is grouped by their head (i.e., the symbol on the left of the arrow) where each SCFG rule has a matching source and target. In some instances, a rule may include a non-terminal. In some instances, the non-terminal can be a variable that is be rewritten for the utterance based on a respective tree transduction rule of the plurality of learned tree transduction rules. In some instances, the plurality of SCFG rules can be learned from the training data.

In some instances, the TTS model generates an NL utterance for each lexicalized SQL query of lexicalized SQL set by (a) reordering nodes of the AST for the respective lexicalized SQL query based on the plurality of SCFG rules and the plurality of tree transduction rules into a reordered AST for the respective lexicalized SQL query and (b) decoding the reordered AST into an NL utterance for the respective lexicalized SQL query based on the respective lexicalized SQL query. In some instances, in order to reorder the nodes of an AST, each SCFG rule of the plurality of SCFG rules can be applied to each child node of the respective AST to identify which nodes correspond to the non-terminals of plurality of SCFG rules and each tree transduction rule of the plurality of tree transduction rules can be applied to each identified node to reorder the nodes to match the structure defined by the plurality of tree transduction rules. For example, an AST for a SQL query can be arranged with a SELECT node representing a SELECT operator in the SQL query in a first layer of the AST, a COLS node representing column(s) in the SQL query in a leftmost branch of a second layer of the AST, a FROM node representing a FROM operator in the SQL query in a middle branch of the second layer of the AST, and a WHERE node representing a WHERE operator in the SQL query in a rightmost branch of the second layer of the AST. The AST can further include a third layer for each node in the second layer and each node in the third layer can represent one or more targets of the nodes of the second layer. For example, the COLS node can include a child node in the third layer that represents the column referenced in the SQL query, the FROM node can include a child node in the third layer that represents the table referenced in the SQL query, and the WHERE node can include a child node in the third layer that represents a value in the column referenced in the SQL query.

The AST can be reordered based on SCFG rules and tree transduction rules. In order words, a new AST can be generated in which one or more child nodes of an existing branch can be moved to another branch and/or new branch and/or an order of the branches can be rearranged (e.g., a leftmost branch becomes a rightmost branch). In some instances, the AST can be reordered by finding all the transduction rules that can apply to an existing tree. An SCFG rule and corresponding tree transduction rule applies when the head of the SCFG rule matches a node in the AST and the state of the node matches the state of the SCFG rule. In some instances, when a portion of the AST matches an SCFG rule, the corresponding tree transduction rule is applied, and a new AST subtree is generated and added to the AST by replacing the branch (or subtree) that matched the SCFG rule with the right-hand side of the SCFG rule as structured by the tree transduction rule. A complete tree transduction begins with the root node being in the initial state (e.g., the SELECT node) then continues with states beneath the root node by propagating down the tree to the leaves until the entire tree has been transduced. In some instances, the TTS model can reorder the AST prior to decoding the reordered AST. In other instances, the AST can be reordered and decoded concurrently. In some instances, the TTS model can be trained with a dataset that includes SQL queries, translated NL utterances for those SQL queries, a tree transduction rule set, and an index that associates one or more tree transduction rules of the tree transduction rule set with each SQL query and its corresponding translated NL utterance.

In some instances, the generated NL utterances can be combined with the set of lexicalized logical forms to form generated training data (i.e., the synthetic training data). In some instances, each generated NL utterance can form a pair with the respective lexicalized logical form of the set of lexicalized logical forms that was used by the TTS model to generate the respective NL utterance. Upon generating the synthetic training data, the synthetic training data can be paraphrased to produce paraphrased synthetic training data. In some instances, the synthetic training data and/or the paraphrased synthetic training data can be combined with the original training data to produce updated training data.

FIG. 5D illustrates an example process 5400 for transforming natural language to SQL. The processing depicted in FIG. 5D may be implemented in software (e.g., code, instructions, a program) executed by one or more processing units (e.g., one or more processors, cores) of the respective systems, hardware, or combinations thereof described throughout. The software may be stored on a non-transitory storage medium (e.g., on a memory device). Although the methods presented in FIG. 5D depict the various processing steps occurring in a particular sequence or order, this is not intended to be limiting. In certain alternative embodiments, the steps may be performed in parallel and/or in a different order. In certain embodiments, such as in the embodiment depicted in FIGS. 1-4F, the processing depicted in FIG. 5D may be performed by a pre-processing subsystem (e.g., pre-processing subsystem 210) and/or the model system 4900.

At block 5402, a machine learning model is trained with the original training data and the synthetic training data to translate an utterance to a logical form. In some instances, the logical form can be a SQL query.

At block 5404, an utterance is accessed. In some instances, the utterance corresponds to a natural language statement, query and/or question. In some instances, the utterance is obtained from one or more sources such as a database (not shown), a computing system (e.g., data preprocessing subsystem), a user, or the like. In some instances, the user is a user interacting with the digital assistant, as described herein with respect to FIGS. 1-3 .

At block 5406, the utterance is input into the trained machine learning model.

At block 5408, the utterance is translated into a logical form using the trained machine learning model. In some instances, the logical form is a SQL query.

At block 5410, the logical form is executed as a query on a database to retrieve a result for the query.

At block 5412, the result is output for the natural language utterance.

As used herein, when an action is “based on” something, this means the action is based at least in part on at least a part of the something. As used herein, the terms “substantially,” “approximately” and “about” are defined as being largely but not necessarily wholly what is specified (and include wholly what is specified) as understood by one of ordinary skill in the art. In any disclosed embodiment, the term “substantially,” “approximately,” or “about” may be substituted with “within [a percentage] of” what is specified, where the percentage includes 0.1, 1, 5, and 10 percent.

Illustrative Systems

FIG. 6 depicts a simplified diagram of a distributed system 600. In the illustrated example, distributed system 600 includes one or more client computing devices 602, 604, 606, and 608, coupled to a server 612 via one or more communication networks 610. Clients computing devices 602, 604, 606, and 608 may be configured to execute one or more applications.

In various examples, server 612 may be adapted to run one or more services or software applications that enable one or more embodiments described in this disclosure. In certain examples, server 612 may also provide other services or software applications that may include non-virtual and virtual environments. In some examples, these services may be offered as web-based or cloud services, such as under a Software as a Service (SaaS) model to the users of client computing devices 602, 604, 606, and/or 608. Users operating client computing devices 602, 604, 606, and/or 608 may in turn utilize one or more client applications to interact with server 612 to utilize the services provided by these components.

In the configuration depicted in FIG. 6 , server 612 may include one or more components 618, 620 and 622 that implement the functions performed by server 612. These components may include software components that may be executed by one or more processors, hardware components, or combinations thereof. It should be appreciated that various different system configurations are possible, which may be different from distributed system 600. The example shown in FIG. 6 is thus one example of a distributed system for implementing an example system and is not intended to be limiting.

Users may use client computing devices 602, 604, 606, and/or 608 to execute one or more applications, models or chatbots, which may generate one or more events or models that may then be implemented or serviced in accordance with the teachings of this disclosure. A client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via this interface. Although FIG. 6 depicts only four client computing devices, any number of client computing devices may be supported.

The client devices may include various types of computing systems such as portable handheld devices, general purpose computers such as personal computers and laptops, workstation computers, wearable devices, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices, and/or the like. These computing devices may run various types and versions of software applications and operating systems (e.g., Microsoft Windows®, Apple Macintosh®, UNIX® or UNIX-like operating systems, Linux or Linux-like operating systems such as Google Chrome™ OS) including various mobile operating systems (e.g., Microsoft Windows Mobile®, iOS®, Windows Phone®, Android™, BlackBerry®, Palm OS®). Portable handheld devices may include cellular phones, smartphones, (e.g., an iPhone®), tablets (e.g., iPad®), personal digital assistants (PDAs), and the like. Wearable devices may include Google Glass® head mounted display, and other devices. Gaming systems may include various handheld gaming devices, Internet-enabled gaming devices (e.g., a Microsoft Xbox® gaming console with or without a Kinect® gesture input device, Sony PlayStation® system, various gaming systems provided by Nintendo®, and others), and the like. The client devices may be capable of executing various different applications such as various Internet-related apps, communication applications (e.g., E-mail applications, short message service (SMS) applications) and may use various communication protocols.

Network(s) 610 may be any type of network familiar to those skilled in the art that may support data communications using any of a variety of available protocols, including without limitation TCP/IP (transmission control protocol/Internet protocol), SNA (systems network architecture), IPX (Internet packet exchange), AppleTalk®, and the like. Merely by way of example, network(s) 610 may be a local area network (LAN), networks based on Ethernet, Token-Ring, a wide-area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infra-red network, a wireless network (e.g., a network operating under any of the Institute of Electrical and Electronics (IEEE) 1002.11 suite of protocols, Bluetooth®, and/or any other wireless protocol), and/or any combination of these and/or other networks.

Server 612 may be composed of one or more general purpose computers, specialized server computers (including, by way of example, PC (personal computer) servers, UNIX® servers, mid-range servers, mainframe computers, rack-mounted servers, etc.), server farms, server clusters, or any other appropriate arrangement and/or combination. Server 612 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization such as one or more flexible pools of logical storage devices that may be virtualized to maintain virtual storage devices for the server. In various examples, server 612 may be adapted to run one or more services or software applications that provide the functionality described in the foregoing disclosure.

The computing systems in server 612 may run one or more operating systems including any of those discussed above, as well as any commercially available server operating system. Server 612 may also run any of a variety of additional server applications and/or mid-tier applications, including HTTP (hypertext transport protocol) servers, FTP (file transfer protocol) servers, CGI (common gateway interface) servers, JAVA® servers, database servers, and the like. Exemplary database servers include without limitation those commercially available from Oracle®, Microsoft®, Sybase®, IBM® (International Business Machines), and the like.

In some implementations, server 612 may include one or more applications to analyze and consolidate data feeds and/or event updates received from users of client computing devices 602, 604, 606, and 608. As an example, data feeds and/or event updates may include, but are not limited to, Twitter® feeds, Facebook® updates or real-time updates received from one or more third party information sources and continuous data streams, which may include real-time events related to sensor data applications, financial tickers, network performance measuring tools (e.g., network monitoring and traffic management applications), clickstream analysis tools, automobile traffic monitoring, and the like. Server 612 may also include one or more applications to display the data feeds and/or real-time events via one or more display devices of client computing devices 602, 604, 606, and 608.

Distributed system 600 may also include one or more data repositories 614, 616. These data repositories may be used to store data and other information in certain examples. For example, one or more of the data repositories 614, 616 may be used to store information such as information related to chatbot performance or generated models for use by chatbots used by server 612 when performing various functions in accordance with various embodiments. Data repositories 614, 616 may reside in a variety of locations. For example, a data repository used by server 612 may be local to server 612 or may be remote from server 612 and in communication with server 612 via a network-based or dedicated connection. Data repositories 614, 616 may be of different types. In certain examples, a data repository used by server 612 may be a database, for example, a relational database, such as databases provided by Oracle Corporation® and other vendors. One or more of these databases may be adapted to enable storage, update, and retrieval of data to and from the database in response to SQL-formatted commands.

In certain examples, one or more of data repositories 614, 616 may also be used by applications to store application data. The data repositories used by applications may be of different types such as, for example, a key-value store repository, an object store repository, or a general storage repository supported by a file system.

In certain examples, the functionalities described in this disclosure may be offered as services via a cloud environment. FIG. 7 is a simplified block diagram of a cloud-based system environment in which various services may be offered as cloud services in accordance with certain examples. In the example depicted in FIG. 7 , cloud infrastructure system 702 may provide one or more cloud services that may be requested by users using one or more client computing devices 704, 706, and 708. Cloud infrastructure system 702 may comprise one or more computers and/or servers that may include those described above for server 612. The computers in cloud infrastructure system 702 may be organized as general-purpose computers, specialized server computers, server farms, server clusters, or any other appropriate arrangement and/or combination.

Network(s) 710 may facilitate communication and exchange of data between clients 704, 706, and 708 and cloud infrastructure system 702. Network(s) 710 may include one or more networks. The networks may be of the same or different types. Network(s) 710 may support one or more communication protocols, including wired and/or wireless protocols, for facilitating the communications.

The example depicted in FIG. 7 is only one example of a cloud infrastructure system and is not intended to be limiting. It should be appreciated that, in some other examples, cloud infrastructure system 702 may have more or fewer components than those depicted in FIG. 7 , may combine two or more components, or may have a different configuration or arrangement of components. For example, although FIG. 7 depicts three client computing devices, any number of client computing devices may be supported in alternative examples.

The term cloud service is generally used to refer to a service that is made available to users on demand and via a communication network such as the Internet by systems (e.g., cloud infrastructure system 702) of a service provider. Typically, in a public cloud environment, servers and systems that make up the cloud service provider's system are different from the customer's own on-premise servers and systems. The cloud service provider's systems are managed by the cloud service provider. Customers may thus avail themselves of cloud services provided by a cloud service provider without having to purchase separate licenses, support, or hardware and software resources for the services. For example, a cloud service provider's system may host an application, and a user may, via the Internet, on demand, order and use the application without the user having to buy infrastructure resources for executing the application. Cloud services are designed to provide easy, scalable access to applications, resources, and services. Several providers offer cloud services. For example, several cloud services are offered by Oracle Corporation® of Redwood Shores, Calif., such as middleware services, database services, Java cloud services, and others.

In certain examples, cloud infrastructure system 702 may provide one or more cloud services using different models such as under a Software as a Service (SaaS) model, a Platform as a Service (PaaS) model, an Infrastructure as a Service (IaaS) model, and others, including hybrid service models. Cloud infrastructure system 702 may include a suite of applications, middleware, databases, and other resources that enable provision of the various cloud services.

A SaaS model enables an application or software to be delivered to a customer over a communication network like the Internet, as a service, without the customer having to buy the hardware or software for the underlying application. For example, a SaaS model may be used to provide customers access to on-demand applications that are hosted by cloud infrastructure system 702. Examples of SaaS services provided by Oracle Corporation® include, without limitation, various services for human resources/capital management, customer relationship management (CRM), enterprise resource planning (ERP), supply chain management (SCM), enterprise performance management (EPM), analytics services, social applications, and others.

An IaaS model is generally used to provide infrastructure resources (e.g., servers, storage, hardware and networking resources) to a customer as a cloud service to provide elastic compute and storage capabilities. Various IaaS services are provided by Oracle Corporation®.

A PaaS model is generally used to provide, as a service, platform and environment resources that enable customers to develop, run, and manage applications and services without the customer having to procure, build, or maintain such resources. Examples of PaaS services provided by Oracle Corporation® include, without limitation, Oracle Java Cloud Service (JCS), Oracle Database Cloud Service (DBCS), data management cloud service, various application development solutions services, and others.

Cloud services are generally provided on an on-demand self-service basis, subscription-based, elastically scalable, reliable, highly available, and secure manner. For example, a customer, via a subscription order, may order one or more services provided by cloud infrastructure system 702. Cloud infrastructure system 702 then performs processing to provide the services requested in the customer's subscription order. For example, a user may use utterances to request the cloud infrastructure system to take a certain action (e.g., an intent), as described above, and/or provide services for a chatbot system as described herein. Cloud infrastructure system 702 may be configured to provide one or even multiple cloud services.

Cloud infrastructure system 702 may provide the cloud services via different deployment models. In a public cloud model, cloud infrastructure system 702 may be owned by a third party cloud services provider and the cloud services are offered to any general public customer, where the customer may be an individual or an enterprise. In certain other examples, under a private cloud model, cloud infrastructure system 702 may be operated within an organization (e.g., within an enterprise organization) and services provided to customers that are within the organization. For example, the customers may be various departments of an enterprise such as the Human Resources department, the Payroll department, etc. or even individuals within the enterprise. In certain other examples, under a community cloud model, the cloud infrastructure system 702 and the services provided may be shared by several organizations in a related community. Various other models such as hybrids of the above mentioned models may also be used.

Client computing devices 704, 706, and 708 may be of different types (such as client computing devices 602, 604, 606, and 608 depicted in FIG. 6 ) and may be capable of operating one or more client applications. A user may use a client device to interact with cloud infrastructure system 702, such as to request a service provided by cloud infrastructure system 702. For example, a user may use a client device to request information or action from a chatbot as described in this disclosure.

In some examples, the processing performed by cloud infrastructure system 702 for providing services may involve model training and deployment. This analysis may involve using, analyzing, and manipulating data sets to train and deploy one or more models. This analysis may be performed by one or more processors, possibly processing the data in parallel, performing simulations using the data, and the like. For example, big data analysis may be performed by cloud infrastructure system 702 for generating and training one or more models for a chatbot system. The data used for this analysis may include structured data (e.g., data stored in a database or structured according to a structured model) and/or unstructured data (e.g., data blobs (binary large objects)).

As depicted in the example in FIG. 7 , cloud infrastructure system 702 may include infrastructure resources 730 that are utilized for facilitating the provision of various cloud services offered by cloud infrastructure system 702. Infrastructure resources 730 may include, for example, processing resources, storage or memory resources, networking resources, and the like. In certain examples, the storage virtual machines that are available for servicing storage requested from applications may be part of cloud infrastructure system 702. In other examples, the storage virtual machines may be part of different systems.

In certain examples, to facilitate efficient provisioning of these resources for supporting the various cloud services provided by cloud infrastructure system 702 for different customers, the resources may be bundled into sets of resources or resource modules (also referred to as “pods”). Each resource module or pod may comprise a pre-integrated and optimized combination of resources of one or more types. In certain examples, different pods may be pre-provisioned for different types of cloud services. For example, a first set of pods may be provisioned for a database service, a second set of pods, which may include a different combination of resources than a pod in the first set of pods, may be provisioned for Java service, and the like. For some services, the resources allocated for provisioning the services may be shared between the services.

Cloud infrastructure system 702 may itself internally use services 732 that are shared by different components of cloud infrastructure system 702 and which facilitate the provisioning of services by cloud infrastructure system 702. These internal shared services may include, without limitation, a security and identity service, an integration service, an enterprise repository service, an enterprise manager service, a virus scanning and whitelist service, a high availability, backup and recovery service, service for enabling cloud support, an email service, a notification service, a file transfer service, and the like.

Cloud infrastructure system 702 may comprise multiple subsystems. These subsystems may be implemented in software, or hardware, or combinations thereof. As depicted in FIG. 7 , the subsystems may include a user interface subsystem 712 that enables users or customers of cloud infrastructure system 702 to interact with cloud infrastructure system 702. User interface subsystem 712 may include various different interfaces such as a web interface 714, an online store interface 716 where cloud services provided by cloud infrastructure system 702 are advertised and are purchasable by a consumer, and other interfaces 718. For example, a customer may, using a client device, request (service request 734) one or more services provided by cloud infrastructure system 702 using one or more of interfaces 714, 716, and 718. For example, a customer may access the online store, browse cloud services offered by cloud infrastructure system 702, and place a subscription order for one or more services offered by cloud infrastructure system 702 that the customer wishes to subscribe to. The service request may include information identifying the customer and one or more services that the customer desires to subscribe to. For example, a customer may place a subscription order for a service offered by cloud infrastructure system 702. As part of the order, the customer may provide information identifying a chatbot system for which the service is to be provided and optionally one or more credentials for the chatbot system.

In certain examples, such as the example depicted in FIG. 7 , cloud infrastructure system 702 may comprise an order management subsystem (OMS) 720 that is configured to process the new order. As part of this processing, OMS 720 may be configured to: create an account for the customer, if not done already; receive billing and/or accounting information from the customer that is to be used for billing the customer for providing the requested service to the customer; verify the customer information; upon verification, book the order for the customer; and orchestrate various workflows to prepare the order for provisioning.

Once properly validated, OMS 720 may then invoke the order provisioning subsystem (OPS) 724 that is configured to provision resources for the order including processing, memory, and networking resources. The provisioning may include allocating resources for the order and configuring the resources to facilitate the service requested by the customer order. The manner in which resources are provisioned for an order and the type of the provisioned resources may depend upon the type of cloud service that has been ordered by the customer. For example, according to one workflow, OPS 724 may be configured to determine the particular cloud service being requested and identify a number of pods that may have been pre-configured for that particular cloud service. The number of pods that are allocated for an order may depend upon the size/amount/level/scope of the requested service. For example, the number of pods to be allocated may be determined based upon the number of users to be supported by the service, the duration of time for which the service is being requested, and the like. The allocated pods may then be customized for the particular requesting customer for providing the requested service.

In certain examples, setup phase processing, as described above, may be performed by cloud infrastructure system 702 as part of the provisioning process. Cloud infrastructure system 702 may generate an application ID and select a storage virtual machine for an application from among storage virtual machines provided by cloud infrastructure system 702 itself or from storage virtual machines provided by other systems other than cloud infrastructure system 702.

Cloud infrastructure system 702 may send a response or notification 744 to the requesting customer to indicate when the requested service is now ready for use. In some instances, information (e.g., a link) may be sent to the customer that enables the customer to start using and availing the benefits of the requested services. In certain examples, for a customer requesting the service, the response may include a chatbot system ID generated by cloud infrastructure system 702 and information identifying a chatbot system selected by cloud infrastructure system 702 for the chatbot system corresponding to the chatbot system ID.

Cloud infrastructure system 702 may provide services to multiple customers. For each customer, cloud infrastructure system 702 is responsible for managing information related to one or more subscription orders received from the customer, maintaining customer data related to the orders, and providing the requested services to the customer. Cloud infrastructure system 702 may also collect usage statistics regarding a customer's use of subscribed services. For example, statistics may be collected for the amount of storage used, the amount of data transferred, the number of users, and the amount of system up time and system down time, and the like. This usage information may be used to bill the customer. Billing may be done, for example, on a monthly cycle.

Cloud infrastructure system 702 may provide services to multiple customers in parallel. Cloud infrastructure system 702 may store information for these customers, including possibly proprietary information. In certain examples, cloud infrastructure system 702 comprises an identity management subsystem (IMS) 728 that is configured to manage customer information and provide the separation of the managed information such that information related to one customer is not accessible by another customer. IMS 728 may be configured to provide various security-related services such as identity services, such as information access management, authentication and authorization services, services for managing customer identities and roles and related capabilities, and the like.

FIG. 8 illustrates an example of computer system 800. In some examples, computer system 800 may be used to implement any of the digital assistant or chatbot systems within a distributed environment, and various servers and computer systems described above. As shown in FIG. 8 , computer system 800 includes various subsystems including a processing subsystem 804 that communicates with a number of other subsystems via a bus subsystem 802. These other subsystems may include a processing acceleration unit 806, an I/O subsystem 808, a storage subsystem 818, and a communications subsystem 824. Storage subsystem 818 may include non-transitory computer-readable storage media including storage media 822 and a system memory 810.

Bus subsystem 802 provides a mechanism for letting the various components and subsystems of computer system 800 communicate with each other as intended. Although bus subsystem 802 is shown schematically as a single bus, alternative examples of the bus subsystem may utilize multiple buses. Bus subsystem 802 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, a local bus using any of a variety of bus architectures, and the like. For example, such architectures may include an Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus, which may be implemented as a Mezzanine bus manufactured to the IEEE P1386.1 standard, and the like.

Processing subsystem 804 controls the operation of computer system 800 and may comprise one or more processors, application specific integrated circuits (ASICs), or field programmable gate arrays (FPGAs). The processors may include be single core or multicore processors. The processing resources of computer system 800 may be organized into one or more processing units 832, 834, etc. A processing unit may include one or more processors, one or more cores from the same or different processors, a combination of cores and processors, or other combinations of cores and processors. In some examples, processing subsystem 804 may include one or more special purpose co-processors such as graphics processors, digital signal processors (DSPs), or the like. In some examples, some or all of the processing units of processing subsystem 804 may be implemented using customized circuits, such as application specific integrated circuits (ASICs), or field programmable gate arrays (FPGAs).

In some examples, the processing units in processing subsystem 804 may execute instructions stored in system memory 810 or on computer readable storage media 822. In various examples, the processing units may execute a variety of programs or code instructions and may maintain multiple concurrently executing programs or processes. At any given time, some, or all of the program code to be executed may be resident in system memory 810 and/or on computer-readable storage media 822 including potentially on one or more storage devices. Through suitable programming, processing subsystem 804 may provide various functionalities described above. In instances where computer system 800 is executing one or more virtual machines, one or more processing units may be allocated to each virtual machine.

In certain examples, a processing acceleration unit 806 may optionally be provided for performing customized processing or for off-loading some of the processing performed by processing subsystem 804 so as to accelerate the overall processing performed by computer system 800.

I/O subsystem 808 may include devices and mechanisms for inputting information to computer system 800 and/or for outputting information from or via computer system 800. In general, use of the term input device is intended to include all possible types of devices and mechanisms for inputting information to computer system 800. User interface input devices may include, for example, a keyboard, pointing devices such as a mouse or trackball, a touchpad or touch screen incorporated into a display, a scroll wheel, a click wheel, a dial, a button, a switch, a keypad, audio input devices with voice command recognition systems, microphones, and other types of input devices. User interface input devices may also include motion sensing and/or gesture recognition devices such as the Microsoft Kinect® motion sensor that enables users to control and interact with an input device, the Microsoft Xbox® 360 game controller, devices that provide an interface for receiving input using gestures and spoken commands. User interface input devices may also include eye gesture recognition devices such as the Google Glass® blink detector that detects eye activity (e.g., “blinking” while taking pictures and/or making a menu selection) from users and transforms the eye gestures as inputs to an input device (e.g., Google) Glass®). Additionally, user interface input devices may include voice recognition sensing devices that enable users to interact with voice recognition systems (e.g., Siri® navigator) through voice commands.

Other examples of user interface input devices include, without limitation, three dimensional (3D) mice, joysticks or pointing sticks, gamepads and graphic tablets, and audio/visual devices such as speakers, digital cameras, digital camcorders, portable media players, webcams, image scanners, fingerprint scanners, barcode reader 3D scanners, 3D printers, laser rangefinders, and eye gaze tracking devices. Additionally, user interface input devices may include, for example, medical imaging input devices such as computed tomography, magnetic resonance imaging, position emission tomography, and medical ultrasonography devices. User interface input devices may also include, for example, audio input devices such as MIDI keyboards, digital musical instruments and the like.

In general, use of the term output device is intended to include all possible types of devices and mechanisms for outputting information from computer system 800 to a user or other computer. User interface output devices may include a display subsystem, indicator lights, or non-visual displays such as audio output devices, etc. The display subsystem may be a cathode ray tube (CRT), a flat-panel device, such as that using a liquid crystal display (LCD) or plasma display, a projection device, a touch screen, and the like. For example, user interface output devices may include, without limitation, a variety of display devices that visually convey text, graphics, and audio/video information such as monitors, printers, speakers, headphones, automotive navigation systems, plotters, voice output devices, and modems.

Storage subsystem 818 provides a repository or data store for storing information and data that is used by computer system 800. Storage subsystem 818 provides a tangible non-transitory computer-readable storage medium for storing the basic programming and data constructs that provide the functionality of some examples. Storage subsystem 818 may store software (e.g., programs, code modules, instructions) that when executed by processing subsystem 804 provides the functionality described above. The software may be executed by one or more processing units of processing subsystem 804. Storage subsystem 818 may also provide authentication in accordance with the teachings of this disclosure.

Storage subsystem 818 may include one or more non-transitory memory devices, including volatile and non-volatile memory devices. As shown in FIG. 8 , storage subsystem 818 includes a system memory 810 and a computer-readable storage media 822. System memory 810 may include a number of memories including a volatile main random access memory (RAM) for storage of instructions and data during program execution and a non-volatile read only memory (ROM) or flash memory in which fixed instructions are stored. In some implementations, a basic input/output system (BIOS), containing the basic routines that help to transfer information between elements within computer system 800, such as during start-up, may typically be stored in the ROM. The RAM typically contains data and/or program modules that are presently being operated and executed by processing subsystem 804. In some implementations, system memory 810 may include multiple different types of memory, such as static random access memory (SRAM), dynamic random access memory (DRAM), and the like.

By way of example, and not limitation, as depicted in FIG. 8 , system memory 810 may load application programs 812 that are being executed, which may include various applications such as Web browsers, mid-tier applications, relational database management systems (RDBMS), etc., program data 814, and an operating system 816. By way of example, operating system 816 may include various versions of Microsoft Windows®, Apple Macintosh®, and/or Linux operating systems, a variety of commercially-available UNIX® or UNIX-like operating systems (including without limitation the variety of GNU/Linux operating systems, the Google Chrome® OS, and the like) and/or mobile operating systems such as iOS, Windows® Phone, Android® OS, BlackBerry® OS, Palm® OS operating systems, and others.

Computer-readable storage media 822 may store programming and data constructs that provide the functionality of some examples. Computer-readable media 822 may provide storage of computer-readable instructions, data structures, program modules, and other data for computer system 800. Software (programs, code modules, instructions) that, when executed by processing subsystem 804 provides the functionality described above, may be stored in storage subsystem 818. By way of example, computer-readable storage media 822 may include non-volatile memory such as a hard disk drive, a magnetic disk drive, an optical disk drive such as a CD ROM, DVD, a Blu-Ray® disk, or other optical media. Computer-readable storage media 822 may include, but is not limited to, Zip® drives, flash memory cards, universal serial bus (USB) flash drives, secure digital (SD) cards, DVD disks, digital video tape, and the like. Computer-readable storage media 822 may also include, solid-state drives (SSD) based on non-volatile memory such as flash-memory based SSDs, enterprise flash drives, solid state ROM, and the like, SSDs based on volatile memory such as solid state RAM, dynamic RAM, static RAM, DRAM-based SSDs, magneto resistive RAM (MRAM) SSDs, and hybrid SSDs that use a combination of DRAM and flash memory based SSDs.

In certain examples, storage subsystem 818 may also include a computer-readable storage media reader 820 that may further be connected to computer-readable storage media 822. Reader 820 may receive and be configured to read data from a memory device such as a disk, a flash drive, etc.

In certain examples, computer system 800 may support virtualization technologies, including but not limited to virtualization of processing and memory resources. For example, computer system 800 may provide support for executing one or more virtual machines. In certain examples, computer system 800 may execute a program such as a hypervisor that facilitated the configuring and managing of the virtual machines. Each virtual machine may be allocated memory, compute (e.g., processors, cores), I/O, and networking resources. Each virtual machine generally runs independently of the other virtual machines. A virtual machine typically runs its own operating system, which may be the same as or different from the operating systems executed by other virtual machines executed by computer system 800. Accordingly, multiple operating systems may potentially be run concurrently by computer system 800.

Communications subsystem 824 provides an interface to other computer systems and networks. Communications subsystem 824 serves as an interface for receiving data from and transmitting data to other systems from computer system 800. For example, communications subsystem 824 may enable computer system 800 to establish a communication channel to one or more client devices via the Internet for receiving and sending information from and to the client devices. For example, when computer system 800 is used to implement bot system 120 depicted in FIG. 1 , the communication subsystem may be used to communicate with a chatbot system selected for an application.

Communication subsystem 824 may support both wired and/or wireless communication protocols. In certain examples, communications subsystem 824 may include radio frequency (RF) transceiver components for accessing wireless voice and/or data networks (e.g., using cellular telephone technology, advanced data network technology, such as 3G, 4G or EDGE (enhanced data rates for global evolution), Wi-Fi (IEEE 802.XX family standards, or other mobile communication technologies, or any combination thereof), global positioning system (GPS) receiver components, and/or other components. In some examples, communications subsystem 824 may provide wired network connectivity (e.g., Ethernet) in addition to or instead of a wireless interface.

Communication subsystem 824 may receive and transmit data in various forms. In some examples, in addition to other forms, communications subsystem 824 may receive input communications in the form of structured and/or unstructured data feeds 826, event streams 828, event updates 830, and the like. For example, communications subsystem 824 may be configured to receive (or send) data feeds 826 in real-time from users of social media networks and/or other communication services such as Twitter® feeds, Facebook® updates, web feeds such as Rich Site Summary (RSS) feeds, and/or real-time updates from one or more third party information sources.

In certain examples, communications subsystem 824 may be configured to receive data in the form of continuous data streams, which may include event streams 828 of real-time events and/or event updates 830, that may be continuous or unbounded in nature with no explicit end. Examples of applications that generate continuous data may include, for example, sensor data applications, financial tickers, network performance measuring tools (e.g., network monitoring and traffic management applications), clickstream analysis tools, automobile traffic monitoring, and the like.

Communications subsystem 824 may also be configured to communicate data from computer system 800 to other computer systems or networks. The data may be communicated in various different forms such as structured and/or unstructured data feeds 826, event streams 828, event updates 830, and the like to one or more databases that may be in communication with one or more streaming data source computers coupled to computer system 800.

Computer system 800 may be one of various types, including a handheld portable device (e.g., an iPhone® cellular phone, an iPad® computing tablet, a PDA), a wearable device (e.g., a Google Glass® head mounted display), a personal computer, a workstation, a mainframe, a kiosk, a server rack, or any other data processing system. Due to the ever-changing nature of computers and networks, the description of computer system 800 depicted in FIG. 8 is intended only as a specific example. Many other configurations having more or fewer components than the system depicted in FIG. 8 are possible. Based on the disclosure and teachings provided herein, it should be appreciated there are other ways and/or methods to implement the various examples.

Although specific examples have been described, various modifications, alterations, alternative constructions, and equivalents are possible. Examples are not restricted to operation within certain specific data processing environments but are free to operate within a plurality of data processing environments. Additionally, although certain examples have been described using a particular series of transactions and steps, it should be apparent to those skilled in the art that this is not intended to be limiting. Although some flowcharts describe operations as a sequential process, many of the operations may be performed in parallel or concurrently. In addition, the order of the operations may be rearranged. A process may have additional steps not included in the figure. Various features and aspects of the above-described examples may be used individually or jointly.

Further, while certain examples have been described using a particular combination of hardware and software, it should be recognized that other combinations of hardware and software are also possible. Certain examples may be implemented only in hardware, or only in software, or using combinations thereof. The various processes described herein may be implemented on the same processor or different processors in any combination.

Where devices, systems, components or modules are described as being configured to perform certain operations or functions, such configuration may be accomplished, for example, by designing electronic circuits to perform the operation, by programming programmable electronic circuits (such as microprocessors) to perform the operation such as by executing computer instructions or code, or processors or cores programmed to execute code or instructions stored on a non-transitory memory medium, or any combination thereof. Processes may communicate using a variety of techniques including but not limited to conventional techniques for inter-process communications, and different pairs of processes may use different techniques, or the same pair of processes may use different techniques at different times.

Specific details are given in this disclosure to provide a thorough understanding of the examples. However, examples may be practiced without these specific details. For example, well-known circuits, processes, algorithms, structures, and techniques have been shown without unnecessary detail in order to avoid obscuring the examples. This description provides example examples only, and is not intended to limit the scope, applicability, or configuration of other examples. Rather, the preceding description of the examples will provide those skilled in the art with an enabling description for implementing various examples. Various changes may be made in the function and arrangement of elements.

The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense. It will, however, be evident that additions, subtractions, deletions, and other modifications and changes may be made thereunto without departing from the broader spirit and scope as set forth in the claims. Thus, although specific examples have been described, these are not intended to be limiting. Various modifications and equivalents are within the scope of the following claims.

In the foregoing specification, aspects of the disclosure are described with reference to specific examples thereof, but those skilled in the art will recognize that the disclosure is not limited thereto. Various features and aspects of the above-described disclosure may be used individually or jointly. Further, examples may be utilized in any number of environments and applications beyond those described herein without departing from the broader spirit and scope of the specification. The specification and drawings are, accordingly, to be regarded as illustrative rather than restrictive.

In the foregoing description, for the purposes of illustration, methods were described in a particular order. It should be appreciated that in alternate examples, the methods may be performed in a different order than that described. It should also be appreciated that the methods described above may be performed by hardware components or may be embodied in sequences of machine-executable instructions, which may be used to cause a machine, such as a general-purpose or special-purpose processor or logic circuits programmed with the instructions to perform the methods. These machine-executable instructions may be stored on one or more machine readable mediums, such as CD-ROMs or other type of optical disks, floppy diskettes, ROMs, RAMs, EPROMs, EEPROMs, magnetic or optical cards, flash memory, or other types of machine-readable mediums suitable for storing electronic instructions. Alternatively, the methods may be performed by a combination of hardware and software.

Where components are described as being configured to perform certain operations, such configuration may be accomplished, for example, by designing electronic circuits or other hardware to perform the operation, by programming programmable electronic circuits (e.g., microprocessors, or other suitable electronic circuits) to perform the operation, or any combination thereof.

While illustrative examples of the application have been described in detail herein, it is to be understood that the inventive concepts may be otherwise variously embodied and employed, and that the appended claims are intended to be construed to include such variations, except as limited by the prior art. 

What is claimed is:
 1. A computer-implemented method comprising: accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; obtaining a pre-trained model trained to translate utterances to logical forms; finetuning the pre-trained model to translate logical forms to utterances, wherein the finetuning is performed using the original training data and generates a finetuned model; generating a set of delexicalized logical forms, at least one delexicalized logical form of the set of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by the finetuned model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.
 2. The computer-implemented method of claim 1, wherein finetuning the pre-trained model comprises adjusting weights and parameters of the pre-trained model based on the original training data and using one or more machine learning optimization techniques.
 3. The computer-implemented method of claim 1, wherein at least one delexicalized logical form of the set of delexicalized forms in generated automatically using a machine-learning model.
 4. The computer-implemented method of claim 1, wherein at least one delexicalized logical form of the set of delexicalized logical forms is generated using a probabilistic context-free grammar.
 5. The computer-implemented method of claim 1, wherein generating the set of lexicalized logical forms comprises analyzing each delexicalized logical form of the set of delexicalized logical forms to identify one or more constraints in the respective delexicalized logical form and sampling components of a database based on the identified one or more constraints in respective delexicalized logical form.
 6. The computer-implemented method of claim 1, wherein the generating the synthetic training data comprises translating, by the finetuned model, each lexicalized logical form of the set of lexicalized logical forms into an utterance.
 7. The computer-implemented method of claim 1, further comprising: accessing an utterance; inputting the utterance into the trained machine learning model; translating, using the trained machine learning model, the utterance into a logical form; executing the logical form as a query on a database to retrieve a result for the query; and outputting the result for the utterance.
 8. A system comprising: one or more processors; and one or more non-transitory computer-readable media storing instructions which, when executed by the one or more processors, cause the one or more processors to perform operations comprising: accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; obtaining a pre-trained model trained to translate utterances to logical forms; finetuning the pre-trained model to translate logical forms to utterances, wherein the finetuning is performed using the original training data and generates a finetuned model; generating a set of delexicalized logical forms, at least one delexicalized logical form of the set of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by the finetuned model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.
 9. The system of claim 8, wherein finetuning the pre-trained model comprises adjusting weights and parameters of the pre-trained model based on the original training data and using one or more machine learning optimization techniques.
 10. The system of claim 8, wherein at least one delexicalized logical form of the set of delexicalized forms in generated automatically using a machine-learning model.
 11. The system of claim 8, wherein at least one delexicalized logical form of the set of delexicalized logical forms is generated using a probabilistic context-free grammar.
 12. The system of claim 8, wherein generating the set of lexicalized logical forms comprises analyzing each delexicalized logical form of the set of delexicalized logical forms to identify one or more constraints in the respective delexicalized logical form and sampling components of a database based on the identified one or more constraints in respective delexicalized logical form.
 13. The system of claim 8, wherein the generating the synthetic training data comprises translating, by the finetuned model, each lexicalized logical form of the set of lexicalized logical forms into an utterance.
 14. The system of claim 8, the operations further comprising: accessing an utterance; inputting the utterance into the trained machine learning model; translating, using the trained machine learning model, the utterance into a logical form; executing the logical form as a query on a database to retrieve a result for the query; and outputting the result for the utterance.
 15. A computer-program product tangibly embodied in one or more non-transitory machine-readable media, including instructions configured to cause one or more data processors to perform the following operations: accessing original training data, the original training data including a plurality of utterances and a plurality of logical forms, each logical form of the plurality of logical forms corresponding to at least one utterance of the plurality of utterances; obtaining a pre-trained model trained to translate utterances to logical forms; finetuning the pre-trained model to translate logical forms to utterances, wherein the finetuning is performed using the original training data and generates a finetuned model; generating a set of delexicalized logical forms, at least one delexicalized logical form of the set of delexicalized logical forms being a delexicalized version of a logical form of the plurality of logical forms; generating a set of lexicalized logical forms by lexicalizing the set of delexicalized logical forms; generating, by the finetuned model, synthetic training data comprising an utterance for each lexicalized logical form of the set of lexicalized logical forms; and training a machine learning model with the original training data and the synthetic training data to translate an utterance to a logical form.
 16. The computer-program product of claim 15, wherein finetuning the pre-trained model comprises adjusting weights and parameters of the pre-trained model based on the original training data and using one or more machine learning optimization techniques.
 17. The computer-program product of claim 15, wherein at least one delexicalized logical form of the set of delexicalized forms in generated automatically using a machine-learning model.
 18. The computer-program product of claim 15, wherein at least one delexicalized logical form of the set of delexicalized logical forms is generated using a probabilistic context-free grammar.
 19. The computer-program product of claim 15, wherein generating the set of lexicalized logical forms comprises analyzing each delexicalized logical form of the set of delexicalized logical forms to identify one or more constraints in the respective delexicalized logical form and sampling components of a database based on the identified one or more constraints in respective delexicalized logical form.
 20. The computer-program product of claim 15, wherein the generating the synthetic training data comprises translating, by the finetuned model, each lexicalized logical form of the set of lexicalized logical forms into an utterance. 